cloudcreativity / json-api

Framework agnostic JSON API serialisation and deserialisation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Detect message body in responses

lindyhopchris opened this issue · comments

At the moment the http_contains_body helper method does not correctly detect message body on a response. This is because the rules for a response having body are different from the rules for a request. For a response:

For response messages, whether or not a message-body is included with a message is dependent on both the request method and the response status code (section 6.1.1). All responses to the HEAD request method MUST NOT include a message-body, even though the presence of entity- header fields might lead one to believe they do. All 1xx (informational), 204 (no content), and 304 (not modified) responses MUST NOT include a message-body. All other responses do include a message-body, although it MAY be of zero length.
https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.3

At the moment, the helper only applies the logic for a request - need to also add logic for a response.

This has been merged into develop.