hyperium / http

Rust HTTP types
Apache License 2.0
1.15k stars 285 forks source link

Why is there a `uri_mut` on `Request` if there's no `&mut self` methods on `Uri`? #602

Closed jjant closed 1 year ago

jjant commented 1 year ago

I found this a bit confusing when I was trying to mutate the Authority for a request's URI.

Is there any particular reason why there's no set_authority, set_path, etc. on &mut Uri? Alternatively, changing Request::uri_mut to Request::set_uri(&mut self, uri: Uri) might be clearer.

seanmonstar commented 1 year ago

You can call *req.uri_mut() = new_uri;.

Mutators for the URI don't exist, since instead the thinking is to use a Builder to create new or adjust existing URIs. See #206.