-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix /api/search endpoint encoding error (#506)
Previously this endpoint was always returning an empty response for valid requests. This is because the last line failed to encode the SearchResult as JSON. After some investigation I can see that this is because we default the Progress fields to `-Inf`. Since these progress fields only seemm to be applicable for streaming use cases that use RPC and don't encode as JSON then it seemed like the best fix was to simply omit them in the JSON response. This change also adds error handling to the JSON encoding so that these errors will be simpler to debug in future. A test is also included that reproduces the issue. You can reproduce this issue and the fix locally by just curling the search endpoint like: ```bash curl -H 'Accept: application/json' -XPOST -d '{"Q":"a.*"}' 'http://127.0.0.1:6070/api/search' -i ```
- Loading branch information
1 parent
5f79575
commit f4df546
Showing
3 changed files
with
43 additions
and
2 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