reactr
reactr copied to clipboard
feat: Add JS resp-set-header and request-set-field bindings
Since this is generated, I don't think we care about the return undefined
-s making the undefined
return value explicit, other than that this looks great, thanks!
Hmm, I'm running the latest sat version (v0.1.4 with Reactr v0.15.1) and created a fork of the API to test this but for some reason there doesn't seem to be an resp-set-header
function exported by the runtime. Super strange. These are all the _exports
, note that there's a request-set-field
, but no resp-set-header
:
{"log_message":"(I) [\"log-msg\",\"fetch-url\",\"graphql-query\",\"cache-set\",\"cache-get\",\"request-get-field\",\"request-set-field\",\"get-static-file\",\"db-exec\",\"get-ffi-result\",\"add-ffi-var\",\"return-result\",\"return-error\",\"canonical_abi_realloc\",\"memory\"]","timestamp":"2022-06-24T00:57:26.413949269+03:00","level":3,"app":{"sat_version":"v0.1.4"},"scope":{"request_id":"a8e52ae8-4152-4be0-905f-82f7907f727f","ident":664900642}}
@flaki Sorry I wasn't more direct about it—https://github.com/suborbital/javy/pull/16 is required to make this work. Running into some build issues over there but once that's resolved that'll be in.
@flaki Sorry I wasn't more direct about it—suborbital/javy#16 is required to make this work. Running into some build issues over there but once that's resolved that'll be in.
Ah, right, it didn't even occur to me that this could be in Javy but ofc that makes perfect sense.
(also I somehow thought the backend bits of this are already in place because of Rust, but of course we are not using wit-bindgen for Rust so...)
@flaki Updated to use a string.
@ospencer if I understand correctly suborbital/reactr#203 adds both get-field
and set-field
, alongside set-header
but for now we only expose set-header
and set-field
~~and at some point we will be able to use getField
to fix, among others suborbital / sat # 134~~
All of the getField
stuff has already been implemented, so I'm not quite sure what you mean! The issue you linked is unrelated, since getField
is used for accessing information about the inbound request rather than outbound ones.
Riiight, sorry, so this is exposing the "middleware" API, a la suborbital/reactr#213 ?
Yeah, exactly.