Skip to content

Conversation

rylev
Copy link
Contributor

@rylev rylev commented Mar 21, 2022

worked on with @yoshuawuyts! 🎉

This PR introduces a few mechanisms which make it easier to handle headers.

In general, we provide rich high-level types that can be mapped to some set of headers. This is accomplished through the AsHeaders trait which allows a type to define an iterator over some set of (HeaderName, HeaderValue).

As a convenience there is the Header trait which allows a type to specify itself as mapping of a type 1 to 1 to a header. This is provided since a 1 to 1 mapping is the most common case and so makes definitions a bit more straight forward.

This change is largely internal facing (i.e., users won't really notice a difference). However, internally, the definition of how to turn a type into headers is much shorter and adding those headers to a request is a bit more succinct.

@rylev rylev requested a review from cataggar March 21, 2022 17:59
@rylev rylev merged commit a9ee934 into Azure:main Mar 22, 2022
@rylev rylev deleted the better-header-handling branch March 22, 2022 10:02
@cataggar cataggar added this to the azure_core 0.2.0 milestone Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants