Home / Companies / Hookdeck / Blog / Post Details
Content Deep Dive

What Are the Differences Between Empty Body and No Body in HTTP/2?

Blog post from Hookdeck

Post Details
Company
Date Published
Author
Valérian Galliat
Word Count
1,961
Language
English
Hacker News Points
-
Summary

In HTTP/2, there is a subtle difference between sending an empty body and no body at all. This distinction can be observed in Cloudflare Workers when dealing with HTTP payloads. While in HTTP/1.1 a request with no body is equivalent to one with an empty body, there's a difference in HTTP/2: a "no body" request sets the END_HEADERS & END_STREAM flags on the HTTP/2 stream, whereas an "empty body" will result in only END_HEADERS (at least in the cURL implementation). This can lead to requests being treated differently, especially when they don't include a Content-Length header.