-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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-ing invalid json content results in 201 Created #1323
Comments
I can still confirm this in the current nightly. Once the body is valid json, but not an object, 201 is returned but no row added. |
Also can reproduce with an empty array: http POST localhost:3000/projects <<JSON
[]
JSON
HTTP/1.1 201 Created Adding an I think a fix can be done by checking the postgrest/src/PostgREST/App.hs Lines 314 to 319 in 0c25f12
|
Mh... this makes it a duplicate of #1070. Closing here in favor of the other one, because there's some other ideas to solve that more generally for on conflict update etc. |
I'm reopening this because I think that turning the string to an empty array instead of failing may cause confusion when there's a mistake in sending a JSON object with extra escapes (which turns it into a string) and then returning a |
Environment
Description of issue
POST-ing a json string you can get a 201 success; even though it's not a valid row. e.g (strace output):
The text was updated successfully, but these errors were encountered: