You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Searchkit version (or git revision) that exhibits the issue: 4.11.2
Last Searchkit version that did not exhibit the issue (if applicable):
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:
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:
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: