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
Wrong content type: "application/json" #1360
Comments
There are some examples of using curl to insert records to elasticsearch in the searchkit page, and they correctly use application/x-ndjson content-type: |
yeh i think the fix here is that it needs to send as content-type |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The problem
I am proxying the searchkit requests through a Rails controller, but it breaks because Rails tries to parse the request.body as json (as the content-type: application/json suggests). But JSON.parse(request.raw_body) blows because the body is actually not proper json, its a concatenation of 2 or more json strings, which on itself is not proper json.
Environment
Details
from inspecting the requests and code, the request body sent is built from:
searchkit/packages/searchkit/src/utils.ts
Line 90 in a2b9df6
and the wrong content-type: application/json is sent from:
searchkit/packages/searchkit/src/Transporter.ts
Line 45 in a2b9df6
Code To Reproduce Issue
Just any searchkit request is technically invalid: if the content-type header is 'application/json' the request body shoud adhere to RFC 7159 and be a proper JSON string (not a newline concatenation).
One way to fix this would be to send
application/x-ndjson
as content-type.The text was updated successfully, but these errors were encountered: