Cannot return 202 from a POST/PUT

Issue #3 open
created an issue

On occasion, you may have a service that accepts a new resource, but submits it to another service for further processing. In that case, the response code should be 202 Accepted, rather than 200 Created (the resource might not be created, depending on what the next service in line does.)

Comments (2)

  1. Justin Sheehy repo owner
    • changed status to open

    You are entirely right that there should be a path in the normal decision logic for a PUT or POST to result in a 202 status code. We will investigate the best extension to the graph and decision core that can enable this result.

    In the meantime, there is a workaround. You can return {halt, 202} in the first element from process_post instead of 'true'. This will cause the request processing to stop, and an immediate 202 response to be sent following that function's return. This is not optimal, but it will allow you to send a 202 response while a more complete solution is being developed.

  2. Anonymous

    Excellent! Thanks for the response, and for the glory that is Webmachine. :) I'm also looking forward to the graph and decision core being extended, so I can grok what it takes (and start giving back fixes instead of just bug reports!).

    Best, Adam

  3. Log in to comment