http_req icon indicating copy to clipboard operation
http_req copied to clipboard

Relative paths aren't parsed

Open isavegas opened this issue 6 years ago • 3 comments

Relative URis such as /path aren't handled correctly. Rather than .path() and .resource() returning /path, they simply return None.

use http_req::uri::Uri;
fn main() {
	// I am expecting `Some("/path")` but receive `None`
	println!("{:?}", "/path".parse::<Uri>().path());
}

isavegas avatar Aug 15 '19 00:08 isavegas

I'm sorry to say it, but Uri does currently not support relative URIs. It supports URIs following the general syntax from RFC 3986

jayjamesjay avatar Aug 16 '19 11:08 jayjamesjay

Dang, alrighty. Would you like to add support? I thought about submitting a pull request, but I wasn't up to messing with it at the time.

isavegas avatar Aug 19 '19 21:08 isavegas

I wasn't going to add support for it soon. You can freely make a pull request, if you want to.

jayjamesjay avatar Aug 20 '19 16:08 jayjamesjay