I'm creating an API in which it is possible to upload a file in a chunked manner.
Going by this Stackoverflow question and answer, the content-range header seems most appropriate for this.
However, in the controller action the header has been stripped so I can't access it. When I use the 'range' header it is available in the request headers collection.
Anyone an idea why the Content-Range is stripped from Requests?
The Content-Range response HTTP header indicates where in a full body message a partial message belongs. Header type. Response header, Payload header. Forbidden header name.
The Accept request HTTP header indicates which content types, expressed as MIME types, the client is able to understand. The server uses content negotiation to select one of the proposals and informs the client of the choice with the Content-Type response header.
Returns an HTTP 201 status code if successful.
Web APIs allow businesses to access 3rd-party data and seamlessly integrate it anywhere and anytime it's required, offering unmatched data processing efficiencies and cost savings. APIs have transformed the way businesses interact with each other and the way they provide value to their customers.
It is not stripped off. Look for it in Request.Content.Headers. It looks like they aligned the headers with the HTTP/1.1 specifications--moving Entity Headers to Request.Content.Headers.
I tried it in a sample request and found it there.
I found this change after reading the relevant sections of RFC 2616. I've been going over it lately because the chief author, Fielding, is also the inventor of the REST architectural style, and I am trying to follow that style using ASP.NET Web API.
I realized that there was a distinction between "request", "response", "general" (used on both request and response but not entity related) and "entity" headers.
Looks as if the ASP.NET team revised the class model to better mirror the RFC, creating three subclasses of HttpHeaders:
These are the verbatim descriptions of the three classes in MSDN (the links are mine):
Note, though that MSDN class description is a bit mistaken - there is no Content Headers definition in the RFC, but it is clear they meant Entity Headers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With