HttpResponseCache icon indicating copy to clipboard operation
HttpResponseCache copied to clipboard

POST method request throws ProtocolException("POST does not support writing") when use it in Java

Open core-lib opened this issue 9 years ago • 0 comments

        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 ?

core-lib avatar Jun 16 '16 11:06 core-lib