Open Ducky2048 opened 10 months ago
This issue is stale because it has been open for 30 days with no activity.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
I just started using httpmock. One thing I immediately noticed is how it doesn't seem to be using the types I'd consider most appropriate.
The
http
crate defines commonly needed http related types which are used by a lot of well-known libraries in the ecosystem like tower, hyper and reqwest.To my surprise, this crate doesn't. For example, it redefines the http
Method
enum instead of using the types from thehttp
crate "everyone else" in the ecosystem uses. I think it would be better to use the common types.Something else I noticed:
When.header
taking(Into<String>, Into<String>)
instead of the (in my opinion) properly typed(Into<http::HeaderName>, Into<http::HeaderValue>)
. (Not every String is a valid http header, which is why in my opinion this type is not quite correct.)Also,
when.Body
takes anInto<String>
, but http can transport many things in its body, including binary data. This is accounted for inThen
as it takes animpl AsRef<[u8]>
but not inWhen
, preventing (as far as I can tell) matching on non-string request bodies.Are these intentional design choices? If not, would you consider pull requests adressing this?