for-GET / http-decision-diagram

An activity diagram to describe the resolution of HTTP response status codes, given various headers.
https://github.com/for-GET/http-decision-diagram/blob/master/doc/2013-06-10-http-hell-no.md
Apache License 2.0
3.63k stars 196 forks source link

Purpose of content_types_accepted and content_types_provided handlers #5

Closed andreineculau closed 11 years ago

andreineculau commented 11 years ago

Like #3 states, content_types_provided:handler is only called for GET/HEAD/PUT but not for POST.

Similarly, as https://github.com/basho/webmachine/issues/122 states, content_types_accepted:handler is only called for POST when post_is_create is true, and for PUT when is_conflict is false, but not for regular POST

Proposed resolution content_types_accepted:handler should be called uniformly, regardless of the invoked HTTP method, right about where known_content_type is called. If it's known, then handle it (ie. translate it to Context) content_types_provided:handler should be called uniformly, regardless of the flow (method, status code) IF there is a Content-Type response header set, and has_resp_body is false, right after webmachine_decision_core:respond handles the logic for HTTP status codes & headers.

andreineculau commented 11 years ago

solved in v4