Closed sbsmith86 closed 7 years ago
@DFurnes I was thinking about reaching out to @blisteringherb about any server settings we could change. I can't figure out how to make the response shorter because quasar wants to ingest everything we have in gladiator and there are competitions with a lot of users in them. Short of just providing total counts, I'm not sure what we can do there.
@DFurnes updated to get the length of the actual HTTP response
@sbsmith86 Oh hmm, I think I might have actually lied on the Str::length
usage - the Content-Length
header should be giving the length in bytes, not "actual" characters, so str_len
is probably the right usage here. Sorry! 😬
What's this PR do?
Adds the
content-length
header to api responses.How should this be manually tested?
Make an api request and see the
content-length
header in the set of response headers.Any background context you want to provide?
Certain api requests were returning invalid JSON.
For example, https://gladiator.dosomething.org/api/v2/contests?page=22 , returns invalid JSON.
I used https://jsonlint.com/ to validate the response object and it is invalid, returning this error:
It looks like it is trying to return the over 2000 users in one of the competitions under the contest and it cuts off the response, making the response invalid JSON. Digging into why this might happen and it looks like if we set the
content-length
header on the response it will specify how long the body of the response should be.Open to other suggestions!
What are the relevant tickets?
Fixes https://www.pivotaltracker.com/story/show/150406511