-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
POST doesn't close the connection when 204 response used #80
Comments
Hey @billmote, i'm not the maintainer but just stumbled upon this issue. while I'd agree that a timeout is suboptimal in this situation, your desired behaviour is kinda confusing as well. 204 is explicitly for situations where you do not have a body.
you're likely suffering from apples decision how to treat these invalid requests.
you should use another status code if you wish to respond with a body, for example |
Interesting @wohlben. I will raise that with the people writing the endpoint. 204 shouldn't be an issue though (ref. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204). It just seems odd that it holds the connection open for a 204 and not a 200. In both cases the work is "done." |
eh, yes. thats exactly the documentation i linked earlier, and the source of my quotes as well. for what its worth: i wasn't able to reproduce your timeout issue on my end. though mockIt never responded with a body either (despite having put that {"success": true} in there), only with the explizit status code, which is
(same with your example request as well)
and finally: https://tools.ietf.org/html/rfc7231#section-6.3.5
/final edit:
|
I worked around the issue by adding a
|
@billmote wonder if it's worth adding this to the docs? What do you think? Sounds like you got a work around, are you happy for me to close this issue? |
I did work around it by not including a body IIRC. Anyone that has this
issue will probably find this. Docs seem unnecessary.
…On Tue, Nov 24, 2020 at 3:03 AM David Boyne ***@***.***> wrote:
@billmote <https://github.com/billmote> wonder if it's worth adding this
to the docs? What do you think?
Sounds like you got a work around, are you happy for me to close this
issue?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#80 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMSPPANVGJORWADCSBGLCLSRNSEDANCNFSM4P7BHPBQ>
.
|
What you did:
Created a POST route
{ "id": "8e54c04a-21fd-4cb3-b8de-1aa5a9ef988e", "route": "/events", "httpMethod": "POST", "statusCode": "204", "delay": "0", "payload": { "success": true }, "headers": [ { "id": "6ffb195d-c434-46da-a08c-52090415c949", "header": "Retry-After", "value": "60" } ], "disabled": false }
that responds with a HTTP 204 with a simple body of
{ success: true }
and posted:curl --request POST '169.254.241.176:3000/events' --header 'Content-Type: application/json' --data-raw '[{"eventId":"fbf1de19-8629-45d3-ad0f-34b8e17d594f","sessionId":"07726e3d-68ed-49a2-bb37-d1372e941191","dateTime":"2020-08-14T01:45:44.975Z","eventType":"App Launched","category":"engagement","latitude":40.4543,"longitude":41.4563},{"eventId":"37314774-d52b-4219-b5c4-e3b2c14aeda0","sessionId":"48830e55-33b2-4a8e-b5c7-710b85b44bf5","dateTime":"2020-08-14T01:56:53.220Z","eventType":"view cart","category":"engagement","latitude":40.4543,"longitude":41.4563,"sku":"abc123","price":10.95},{"eventId":"6c8a2370-0fb0-4c47-8914-11a8e2ffe47f","sessionId":"48830e55-33b2-4a8e-b5c7-710b85b44bf5","dateTime":"2020-08-14T01:57:23.341Z","eventType":"App Launched","category","engagement","latitude":40.4543,"longitude":41.4563}]'
What happened:
The body isn't delivered for ~90 seconds -- my connection timeout on the client is set to 30 seconds.
Problem description:
Because it should immediately respond and close the connection?
Suggested solution:
Changing nothing other than the response code back to HTTP 200 fixes the problem (the route responds instantaneously), but I would like to emulate several of the available responses, and I specifically need the 204 response for this POST :)
The text was updated successfully, but these errors were encountered: