-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
/query
rest endpoint should return valid JSON (#3819)
NOTE: for the 5.4.x release the decision was made to NOT fix the badly formed JSON for existing push queries. This has only been fixed for pull queries :( Previously, the RESTful `/query` endpoint was returning invalid json. For example: ```json {"row":{"columns":["USER_1","PAGE_1",1,"1"], "errorMessage": null, "finalMessage": null,"terminal":true}}} {"row":{"columns":["USER_2","PAGE_2",2,"2"], "errorMessage": null, "finalMessage": null,"terminal":true}}} {"row": null, "errorMessage": null, "finalMessage":"Limit Reached","terminal":true}}" ``` Each _line_ contained a valid JSON object, but the payload as a whole was invalid and the parsing fails if a string contains an embedded new line character. The payload as a whole is now a valid JSON document, being a JSON array of rows, and can handle strings with embedded new line characters. In addition, I've hidden null fields and the 'terminal' field, which was never supposed to be in the JSON. The output now looks like: ```json {"row":{"columns":["USER_1","PAGE_1",1,"1"]}}, {"row":{"columns":["USER_2","PAGE_2",2,"2"]}}, {"finalMessage":"Limit Reached"}]" ``` The CLI is backwards compatible with older versions of the server, though it won't output column headings from older versions. BREAKING CHANGE: the response from the RESTful API for push queries has changed: it is now a valid JSON document containing a JSON array, where each element is JSON object containing either a row of data, an error message, or a final message. The `terminal` field has been removed. (cherry picked from commit 13ced13)
- Loading branch information
1 parent
9a47eaf
commit b278e83
Showing
4 changed files
with
62 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters