hyperium / hyper

An HTTP library for Rust
https://hyper.rs
MIT License
14.42k stars 1.59k forks source link

Provide Conversion from url::Url to hyper::Uri #3329

Closed ctsrc closed 12 months ago

ctsrc commented 12 months ago

Is your feature request related to a problem? Please describe.

I'm always frustrated when I have a url::Url and I need a hyper::Uri

Describe the solution you'd like

Provide an impl From<url::Url> for hyper::Uri

Describe alternatives you've considered

Doing it myself every time.

let uri: Uri = url.as_str().parse()?;

Additional context

Previously requested by someone else as well a few years ago but then closed. https://github.com/hyperium/hyper/issues/1219

RamziA961 commented 12 months ago

AFAIK, hyper uses http::uri and does not use the url crate as a dependency. I would take this on, if the maintainers are not opposed to it.

seanmonstar commented 12 months ago

The issue you linked to has good context, as well as this one: https://github.com/hyperium/http/issues/73

In short, we don't want to tie the stability of url to hyper.