Skip to content

Conversation

@crodas
Copy link

@crodas crodas commented Jan 23, 2026

Add support for sending application/x-www-form-urlencoded form data in HTTP requests via a new with_form() method on Request.

  • Add serde_urlencoded dependency for form serialization
  • Add SerdeUrlencodeError variant to handle encoding failures
  • Add unit tests for form encoding behavior
  • Add integration tests for form submission

Add support for sending application/x-www-form-urlencoded form data in HTTP
requests via a new `with_form()` method on `Request`.

- Add `serde_urlencoded` dependency for form serialization
- Add `SerdeUrlencodeError` variant to handle encoding failures
- Add unit tests for form encoding behavior
- Add integration tests for form submission
@crodas crodas force-pushed the feature/with_form branch from f341a66 to a253ca1 Compare January 23, 2026 00:02
Add instead a minimal equivalent that uses serde to serialize any struct with
url encoding
@crodas crodas requested a review from TheBlueMatt January 23, 2026 16:09
}

/// Percent-encode a string for use in URL form data.
fn percent_encode(s: &str) -> String {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the biggest fan of adding all this serialization boilerplate here. At the very least we should DRY this up after #467 lands, as we have at least all the the percent encoding stuff, etc there.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative would be to receive something that can be converted into Vec<(&str, &str)>, and in that case, it would be useful enough, but I think, since this would be optional, using some serde magic is acceptable, but I lack context to make that judgment call.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Offering only the serde-based option kinda sucks (now you have to use serde just to percent-encode a few fields? bleh) but if y'all have a desire for a serde-based option I don't see a reason that we can't offer it as well.

Indeed, though, we should figure out how to sequence this with #467 since there's overlap.

@TheBlueMatt TheBlueMatt removed their request for review January 26, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants