-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Labels
Description
The POST
variant of the product projection search expects the body to be an application/x-www-form-urlencoded
string.
By default, providing a valid body leads to errors and / or parameters being omitted, because of the body being stringified by the http middleware.
An simple workaround is to set the headersWithStringBody
options:
const client = new ClientBuilder()
.withProjectKey(projectKey)
.withMiddleware(createAuthForClientCredentialsFlow(authMiddlewareOptions))
.withMiddleware(createHttpClient({
...httpMiddlewareOptions,
headersWithStringBody: ['application/x-www-form-urlencoded'],
}))
.withUserAgentMiddleware()
.build()
I suppose this content-type could be added by default.
Also, the documentation refers to a JSON string
, which seems to be incorrect.
As a nice to have, is there any chance the sdk could provide a POST
search accepting a body as a POJO object with the same type as its GET
counterpart rather than having to manually url-encode the body?