1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-24 04:02:07 +03:00

Merge pull request #343 from JonWatson/master

PATCH body/output support
This commit is contained in:
Jesse Wilson
2013-11-03 08:38:56 -08:00
2 changed files with 3 additions and 3 deletions

View File

@@ -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. */

View File

@@ -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");
}
}