spin
spin copied to clipboard
Outbound HTTP component ignores `params` field
http-types.wit
defines the request
type to have a member params
which is documented as // The HTTP parameter queries, represented as a list of (name, value) pairs.
If you set this on an outbound request, it is ignored - no query string is included the URL.
We should either respect params
, or remove it from the outbound request type.
remove it from the outbound request type
We should consider removing it entirely (moving it into SDKs); param parsing can be subtly different in different languages.
One thing to consider if removing is that we are reusing the HTTP request and response type definitions across the HTTP trigger and the outbound HTTP implementation.
Yeah, I'm suggesting removing it from everywhere. Using url form encoding for params is "just" a (very common) convention.
this is also impacting tweet embedding in bartholomew
.
if i understand correctly, the consensus is to remove the params parameter from wit types file and make corresponding changes in sdk's?
If we're removing params
this is not a good first issue.
For outbound HTTP the params
field is currently non-functional but it looks like the query part of the request URI should be working; at least, I don't see in the code that it is being removed.
Current behaviour from testing:
- Inbound
- The original query string is included in
url
- The
params
field is populated
- The original query string is included in
- Outbound
- If you include a query string in
url
it is preserved verbatim (as Lann predicted) - If you set
params
it is ignored
- If you include a query string in
- Inbound
- The original query string is included in url
Well that's good. I propose we:
- Switch our SDKs to use only the query for both inbound and outbound
- Document that
params
is deprecated - Drop
params
the next time we make breaking changes to the http interfaces (after streams support lands, if not sooner)
I will send a PR for 1 and 2.
Slight correction: if you include a query string on an outbound request, Spin leaves it alone. But if you're using the Rust SDK, that strips it out (before passing the request to Spin).