/** * Determines whether a request with the given headers should have a body. * * @param headers HTTP request's headers * @return true if the headers indicate the request should have a body, false otherwise */ public static boolean requestHasBody(RawHttpHeaders headers) { // The presence of a message body in a request is signaled by a // Content-Length or Transfer-Encoding header field. Request message // framing is independent of method semantics, even if the method does // not define any use for a message body. return headers.contains("Content-Length") || headers.contains("Transfer-Encoding"); }
/** * Determines whether a request with the given headers should have a body. * * @param headers HTTP request's headers * @return true if the headers indicate the request should have a body, false otherwise */ public static boolean requestHasBody(RawHttpHeaders headers) { // The presence of a message body in a request is signaled by a // Content-Length or Transfer-Encoding header field. Request message // framing is independent of method semantics, even if the method does // not define any use for a message body. return headers.contains("Content-Length") || headers.contains("Transfer-Encoding"); }