Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
interface Microsoft.​AspNetCore.​Http.​Features.​IHttpRequestBodyDetectionFeature
Assembly: Microsoft.AspNetCore.Http.Features
Used to indicate if the request can have a body.
Properties
bool
CanHaveBody
Indicates if the request can have a body.
Remarks This returns true when:
<list type="bullet">
<item>
<description>
It's an HTTP/1.x request with a non-zero Content-Length or a 'Transfer-Encoding: chunked' header.
</description>
</item>
<item>
<description>
It's an HTTP/2 request that did not set the END_STREAM flag on the initial headers frame.
</description>
</item>
<item>
<description>
It's an HTTP/3 request that did not set the END_STREAM flag on the initial headers frame.
</description>
</item>
</list>
The final request body length may still be zero for the chunked or HTTP/2 scenarios.
<para>
This returns false when:
<list type="bullet"><item><description>
It's an HTTP/1.x request with no Content-Length or 'Transfer-Encoding: chunked' header, or the Content-Length is 0.
</description></item><item><description>
It's an HTTP/1.x request with Connection: Upgrade (e.g. WebSockets). There is no HTTP request body for these requests and
no data should be received until after the upgrade.
</description></item><item><description>
It's an HTTP/2 request that set END_STREAM on the initial headers frame.
</description></item><item><description>
It's an HTTP/3 request that set END_STREAM on the initial headers frame.
</description></item></list></para>
When false, the request body should never return data.