Closed yueyuzhao closed 5 years ago
Hi there,
Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:
However, this issue will not be locked and everyone is still free to discuss solutions to your problem!
Thanks.
Hi @driesvints , thanks for your advice, but I do think this is a bug.
For example, this is what I had in my routes/web.php
:
Route::get('test', function () {
return 'hello';
});
when I made a HEAD request to this, I should have had Content-Length: 5
field in the headers.
From this post from stackoverflow and HTTP 1.1 RFC
The Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs, sent to the recipient or, in the case of the HEAD method, the size of the entity-body that would have been sent had the request been a GET.
In my opinion there should be a Content-Length
field with content length in the response headers.
And HTTP RFC sec9.4
The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request.
@yueyuzhao if this is a bug then please fill out the issue template. Please submit again. Thanks.
Hi there, I want to return
Content-Length
field in the response headers inHEAD
requests, but I always getContent-Length: 0
. I read the codes and found thatSymfony\Component\HttpFoundation\Response@perpare
handles HEAD request and cleans body and keepsContent-Length
, but the framework doesn't set that.