Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support conversions from url::Url #375

Closed

Conversation

davidbarsky
Copy link
Contributor

Motivation

  • A few AWS services (like SQS, IAM, EC2) use application/x-www-form-urlencoded-based RPC calls. While this encoding is typically handled by the SDKs, this code needs to exist somewhere.
  • An off-by-default feature flag enabling a TryFrom conversion from url::Url allows for building complex queries using url::Url's builder methods, but then converting to http::Uri at request construction time.
  • Since all of http's builders implement accept a TryFrom<T> (in http::request::Builder's case, a Uri: TryFrom<T>), this feature allows for passing a url::Url into a request builder.

Cargo.toml Outdated Show resolved Hide resolved
@davidbarsky
Copy link
Contributor Author

(cc: @seanmonstar.)

@seanmonstar
Copy link
Member

Relevant discussion about why this hasn't been implemented in the past: #73

@davidbarsky
Copy link
Contributor Author

@seanmonstar Thanks for the background context. There are a few circumstances—namely, the AWS use-case—where I am constructing full URLs, not just URI fragments that compose into a target of an HTTP request. I think this PR implements the relatively conservative conversions as outlined in Carl's comment: #73 (comment).

@davidbarsky
Copy link
Contributor Author

Not sure if any decision have been made on this PR but I think something along the lines of #276 would address some of the goals of this PR. I'd be happy to revive #276.

(cc: @carllerche.)

@seanmonstar seanmonstar closed this Oct 2, 2023
@davidbarsky davidbarsky deleted the davidbarsky/try-from-url branch October 2, 2023 14:43
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