-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: regression that truncates error message when offset is out of bounds #4518
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
base: main
Are you sure you want to change the base?
fix: regression that truncates error message when offset is out of bounds #4518
Conversation
src/PostgREST/Response.hs
Outdated
| let | ||
| (status, contentRange) = RangeQuery.rangeStatusHeader iTopLevelRange rsQueryTotal rsTableTotal | ||
| cLHeader = if headersOnly then mempty else [contentLengthHeaderStrict rsBody] | ||
| cLHeader = if headersOnly then mempty else [contentLengthHeaderLazy bod] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was taking the SQL query result [] thus setting Content-Length: 2 and then truncating the error response message. Currently checking if this didn't happen anywhere else for the other responses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks the 201 responses for INSERTS weren't returning a Content-Length either, only for the cases of Content-Length: 0 (Only 204 No Content responses are forbidden of doing so according to the spec IIRC). I added that in the second commit.
| { matchStatus = 416 | ||
| , matchHeaders = ["Content-Range" <:> "*/0"] | ||
| , matchHeaders = [ "Content-Range" <:> "*/0" | ||
| , "Content-Length" <:> "144"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test only responds with the Content-Length when it's added to matchHeaders... this is unexpected for a test since it shouldn't modify how our application works. Unless there's a way to make this same request and avoid getting the "Content-Length" or ignore it?
…unds - Happens when offset > the number of rows and when "Prefer: count=exact" header is sent - Regression introduced in commit 57ef998
For when a preference other than return=representation is requested.
a99a073 to
ac6451f
Compare
Closes #4455
(WIP)