HttpResponseCache
HttpResponseCache copied to clipboard
POST method request throws ProtocolException("POST does not support writing") when use it in Java
try {
if (doOutput) {
if (method == HttpEngine.GET) {
// they are requesting a stream to write to. This implies a POST method
method = HttpEngine.POST;
} else if (method != HttpEngine.POST && method != HttpEngine.PUT) {
// If the request method is neither POST nor PUT, then you're not writing
throw new ProtocolException(method + " does not support writing");
}
}
httpEngine = newHttpEngine(method, rawRequestHeaders, null, null);
} catch (IOException e) {
httpEngineFailure = e;
throw e;
}
why did you use "==" while comparing two strings instead of equals method ?