octoparts
octoparts copied to clipboard
Support easy way building body parameter in API client and Admin console
It seems that ParamType.Body parameters's outputName
is not used.
https://github.com/m3dev/octoparts/blob/1a12031bea4b7e5b25814a225094cd61f175998f/app/com/m3/octoparts/aggregator/handler/HttpPartRequestHandler.scala#L80-L82
HTTP POST parameters require key1=value1&key2=value2
format.
However HttpPartRequestHandler#createBlockingHttpRetrieve
use one first parameter and only value.
We can not call HTTP Post API.
If I remember correctly, for body param types, we expect you to just send one + we don't it validate it. I don't think this was made clear in the documentation though.
The reasoning was:
- There is, as far as I know, no "one way" for how to send a body to an HTTP endpoint.
- Thus, there are people POST'ing XML, JSON, message pack, EDN, you name it to their APIs
- In the interest of having something that supports POSTing (or PUTing) stuff, just support sending the body as-is from the client.
I'm not sure if we have re-thought the above, but I would suggest the following course of action:
- At least for now, update docs to make it clear we don't handle more than 1 body parameter
- Think about whether or not we want to support validating body parameters
- If so in what (limited) way ? How do we choose ?
- Implement the feature
- Update the docs again.
We can not call HTTP Post API.
If you can not call the HTTP Post API, that is a different problem; it should still work. Maybe more details are needed.
Ok, I see. ParamType.Body is used any format as XML, JSON and so on.
I can not find the way how to setting HTTP Post API
parameters.
Other ParamType s (Query, Path, Header, Cookie) do not seem usable to POST body.
How I do configure?
Right, it looks like currently your best shot is to prepare a post body client side and send it as a body parameter. This prevents you from validating parameters in Octoparts which is a bit of a waste ... I think this design miss was because we focused on REST.
I see. I understood that Octoparts behave as proxy so it bit difficult to parse and validate body.
I think, It is enough that Octoparts client and Admin console is possible to build body from some parameters. Octoparts server still does not parse and validate body. And these parameters can not be used at cache control key.
What do you think?
I think that seems reasonable.
That said, to make this useful, we should make sure that the feature works across common body types; unless if there's a more scientific way, we should probably make sure the ones that Play supports can be built.
Namely:
- XML
- JS
- Form
- normal string
I agree that the feature works across common body types.