Closed Tyki closed 6 years ago
This is not a bug: HTTP is very peculiar, and implicit body is a purely HTTP thing. This behavior is not applicable to any other protocol.
If you need your payload
property to be in the body part of a Request
object using a non-HTTP protocol, then you need to send the following data: {body: {payload: {}}
Any other property at the root of the sent data will be treated as extra arguments, and thus stored in the request.input.args
part of a request.
So here Kuzzle behaves as expected.
On the other hand, to have these extra arguments with HTTP, you need to pass them in the URL.
You may check our documentation about standard requests syntax: https://docs.kuzzle.io/api-documentation/query-syntax/common-attributes/
The data given for a plugin controller are not in the same place, based on WS or AJAX.
I declared a POST endpoint in my custom plugin.
On WS, using Kuzzle SDK JS :
Kuzzle.query({controller: 'plugin/Controller', action: 'myAction'}, {payload: {}}
. => Thepayload
object is insiderequest.input.args
Using Ajax, with the same controller/action and the same payload, the data will be present in
request.input.body
Expected Behavior
I don't know if that's really a bug, but I had assumed that a POST endpoint using AJAX would still be usable for WS usages.
Current Behavior
Data is in different places, from the Kuzzle Request
Steps to Reproduce
Context (Environment)
Docker instances Kuzzle 1.2.9