lipanski / mockito

HTTP mocking for Rust!
MIT License
695 stars 59 forks source link

Introduce a local IntoHeaderName trait to avoid exposing hyper::header::HeaderName #181

Closed lipanski closed 1 year ago

lipanski commented 1 year ago

Related to https://github.com/lipanski/mockito/pull/179 and the alternative to https://github.com/lipanski/mockito/pull/180

andrewtoth commented 1 year ago

Hmm but this will panic internally if an invalid header name string is provided.

lipanski commented 1 year ago

Hmm but this will panic internally if an invalid header name string is provided.

yes and that’s consistent with other methods (like setting the status code to something invalid).

what are you trying to achieve actually or what was the intention behind your initial change?

andrewtoth commented 1 year ago

Fair enough. It is more ergonomic this way and like you said backwards compatible, so no longer a breaking change.

what are you trying to achieve actually or what was the intention behind your initial change?

Initially motivated by this https://github.com/lipanski/mockito/issues/117. I also ran into the issue of not matching multiple header values individually. By first grouping matchers by header name I think it will be an easier lift to match each header value to a specific header matcher for a given header name. Not sure what your thoughts are on that issue, but maybe we can continue the conversation there?