mirror of
https://github.com/square/okhttp.git
synced 2026-01-24 04:02:07 +03:00
Allow PATCH to have body/output
This commit is contained in:
@@ -339,7 +339,7 @@ public class HttpEngine {
|
||||
}
|
||||
|
||||
boolean hasRequestBody() {
|
||||
return method.equals("POST") || method.equals("PUT");
|
||||
return method.equals("POST") || method.equals("PUT") || method.equals("PATCH");
|
||||
}
|
||||
|
||||
/** Returns the request body or null if this request doesn't have a body. */
|
||||
|
||||
@@ -254,8 +254,8 @@ public class HttpURLConnectionImpl extends HttpURLConnection implements Policy {
|
||||
if (method.equals("GET")) {
|
||||
// they are requesting a stream to write to. This implies a POST method
|
||||
method = "POST";
|
||||
} else if (!method.equals("POST") && !method.equals("PUT")) {
|
||||
// If the request method is neither POST nor PUT, then you're not writing
|
||||
} else if (!method.equals("POST") && !method.equals("PUT") && !method.equals("PATCH")) {
|
||||
// If the request method is neither POST nor PUT nor PATCH, then you're not writing
|
||||
throw new ProtocolException(method + " does not support writing");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user