Skip to content

Commit

Permalink
Don't send chunked transfer for DELETE requests
Browse files Browse the repository at this point in the history
This commit adds `DELETE` requests to the list of HTTP methods which
shouldn't send `Transfer-Encoding: chunked` request headers by default.

The HTTP specification states that for `GET`, `HEAD` and `DELETE`
requests, a payload has "no defined semantics" and "might cause existing
implementations to reject the request".
See https://tools.ietf.org/html/rfc7231#section-4.3.5

This commit aligns the `DELETE` behavior on other, similar HTTP methods.
  • Loading branch information
bclozel authored and smaldini committed Sep 11, 2017
1 parent 865d6e8 commit d44250c
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -109,7 +109,9 @@ public Publisher<Void> apply(NettyInbound in, NettyOutbound out) {
.add(HttpHeaderNames.HOST, host)
.add(HttpHeaderNames.ACCEPT, ALL);

if (parent.method == HttpMethod.GET || parent.method == HttpMethod.HEAD) {
if (parent.method == HttpMethod.GET
|| parent.method == HttpMethod.HEAD
|| parent.method == HttpMethod.DELETE) {
ch.chunkedTransfer(false);
}

Expand Down

0 comments on commit d44250c

Please sign in to comment.