check body length instead of 304 code to determine there is no body#399
check body length instead of 304 code to determine there is no body#399amir-arad wants to merge 1 commit into
Conversation
e419334 to
de00029
Compare
|
This removes functionality, just because the original request had no content doesn't mean that the proxy cannot return content. 304 is one of the only status codes where you are not allowed to provide a response body. |
|
Hrm. There was a lot of discussion on this on issue #251. The original intent was to prevent authors from having to deal with an unexpectedly null body in the decorator. I think the thought at the time was "If there's no body, there's nothing to decorate." I think @amir-arad solution is in line with this original intent -- it just expands and is more explicit about why it's skipping. @raphaeleidus line of thinking is also interesting. I'm inclined to update the docs to indicate that an author has to be prepared for empty/null body. This would preserve the functionality that allows the decorator to add a body on a body-less proxy response. I think in this case, I'd continue to keep the 304 guard because a body can't be added, and this is efficient to skip the test. Thanks both for contributing. Let me consider this. |
|
@amir-arad Thanks for the positive conversation about this feature. Based on discussion on #408 I'm gonna close this one for now. Feel free to re-open if you want to continue the conversation. |
there are many scenarios where a response should have no body (302 is what I've encountered, but there are more).
current behavior is to check for 304 status, I suggest checking the body's length is simpler, covers more real life scenarios (like 200 with no body, it happens some times).