Skip to content

Conversation

@amitu
Copy link
Contributor

@amitu amitu commented Jun 8, 2025

When a wasm+proxy:// url is used in an http processor, the POST request body were not sent. This is fixed in this PR. Support for tuple style POST body params is also added to ftd.submit_form, this works similar to the ftd.http function:

ftd.submit_form(
    action_url,
    ("concept-url", concept_url), ;; ignore server sent errors by not providing a third element
    ("status", status, error) ;; server sent error for "status" will be stored in the `error` variable
)

The third element of the tuple is an optional mutable variable defined as:

-- optional string $status-error:

Note that the use of optional is necessary as using just the string
type would issue warning and will not get updated from js.

  • fix: Send POST body to a wasm+proxy:// url.
  • feat: ftd.submit_form support tuple style args for POST body params.
  • cleanup: remove some unused rust functions

The associated ft_sdk PR is not necessary to work with changes in this PR. It can be merged later.

- process headers in a single place.
- use to_serde_value
- convert response to serde_json directly instead of first converting it
  to utf 8 string.
@siddhantk232 siddhantk232 self-requested a review June 9, 2025 10:14
amitu and others added 6 commits June 9, 2025 17:45
In an ftd function body, you can use the tuple variant of
`ftd.submit_form` method. This does not require you to have a
`ftd.string-field` instance.

```ftd
ftd.submit_form(
    action_url,
    ("concept-url", concept_url),
    ("status", status, error)
)
```

The third element of the tuple is a mutable variable defined as:

```ftd
-- optional string $status-error:
```

Note that the use of `optional` is necessary as using just the `string`
type would issue warning and will not get updated from js.
- cargo update
- version bump in fastn/Cargo.toml
- Update changelog
@siddhantk232 siddhantk232 self-requested a review June 10, 2025 07:39
@siddhantk232 siddhantk232 merged commit 64d997e into main Jun 10, 2025
1 check failed
@siddhantk232 siddhantk232 changed the title wip: post is working fix: POST body in wasm+proxy:// urls in http processors and ftd.submit_form enhancements. Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants