Fix empty JSON API responses
What does this MR do?
In gitlab-workhorse!510 (comment 350220349) we learned that the Grape API sends a HTTP response with Content-Length: 4
and the body null
if you don't give it an explicit body.
This is particularly the case for responses that expect workhorse to handle the response body, but I fixed every case I saw.
We're using this feature of grape: https://github.com/ruby-grape/grape/pull/850
It doesn't let us send a 200 application/json
response with an empty body. The current approach sends a 204 No Content instead. We could switch to text/plain
to allow the 200 instead. I'll see what tests fail (if any) and make a decision on what makes most sense.
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team