hyperium / hyper

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

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

Closed ctsrc closed 1 year ago

ctsrc commented 1 year 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 1 year 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 1 year 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.