http-types icon indicating copy to clipboard operation
http-types copied to clipboard

expose Headers::new and Extensions::new

Open jbr opened this issue 4 years ago • 6 comments

Other users than http-rs might want to use these types, but they cannot currently be constructed outside of this crate

jbr avatar Jan 16 '21 00:01 jbr

needs a rebase for clippy

Fishrock123 avatar Jan 19 '21 19:01 Fishrock123

I'm okay with this change, but think we should document that this is most likely not what you want to do. Someone coming from hyperium/http may incorrectly assume that Headers instances need to manually be created. Instead this really only serves as an intermediate type that is meant to be accessed through Request, Response, etc. Much like a trait is, but slightly different.

Just exposing this without guidance may cause confusion, and we should try and evade that if possible. (Though it'd be correct to point out that our current guidance on these types isn't great either, and folks may already be confused. But ideally we shouldn't add to that 😅 )

yoshuawuyts avatar Jan 22 '21 17:01 yoshuawuyts

[wrong thread; oops]

yoshuawuyts avatar Jan 22 '21 17:01 yoshuawuyts

I think this could be useful if you could set the headers when constructing a request, at least that would make per-client headers in Surf config a tad nicer under the hood.

Fishrock123 avatar Jul 05 '21 19:07 Fishrock123

I think this could be useful if you could set the headers when constructing a request, at least that would make per-client headers in Surf config a tad nicer under the hood.

why not using Middleware?

CfirTsabari avatar Jul 12 '21 08:07 CfirTsabari

Unimportant implementation detail, but feature wise, convenience.

Fishrock123 avatar Jul 12 '21 16:07 Fishrock123