Skip to content
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

No Location header when primary key is not specified in select= #1162

Closed
steve-chavez opened this issue Aug 4, 2018 · 0 comments
Closed
Labels
bug http http compliance minor

Comments

@steve-chavez
Copy link
Member

psql -c 'CREATE TABLE test_bulk(id serial primary key, code text)'

curl -i -X POST -d '{"code":42}' \
-H 'Prefer:return=representation' \
-H "Content-type: application/json" \
"localhost:3000/test_bulk?select=code"

#HTTP/1.1 201 Created
#Transfer-Encoding: chunked
#Date: Sat, 04 Aug 2018 17:58:57 GMT
#Server: postgrest/0.5.0.0 (fa1e92f)
#Content-Type: application/json; charset=utf-8
#Content-Range: */*

#[{"code":"42"}]

curl -i -X POST -d '{"code":42}' \
-H 'Prefer:return=representation' \
-H "Content-type: application/json" \
"localhost:3000/test_bulk?select=id,code"

#HTTP/1.1 201 Created
#Transfer-Encoding: chunked
#Date: Sat, 04 Aug 2018 18:00:44 GMT
#Server: postgrest/0.5.0.0 (fa1e92f)
#Location: /test_bulk?id=eq.2
#Content-Type: application/json; charset=utf-8
#Content-Range: */*

#[{"id":2,"code":"42"}]
@steve-chavez steve-chavez added the http http compliance label Sep 28, 2019
monacoremo pushed a commit to monacoremo/postgrest that referenced this issue Jul 17, 2021
* Create location header only on primary key columns, closes PostgREST#1461

* Return location header when pk columns not selected, fixes PostgREST#1162
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug http http compliance minor
Development

No branches or pull requests

1 participant