Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement md.merge(other) #292

Open
asvetlov opened this issue Sep 28, 2018 · 3 comments
Open

Implement md.merge(other) #292

asvetlov opened this issue Sep 28, 2018 · 3 comments

Comments

@asvetlov
Copy link
Member

The method should be mimic to md.extend() but add only keys from other that are absent in self.

The behavior is very useful for merging aiohttp session defaults into passed headers for example.

@webknjaz
Copy link
Member

Why not replace existing keys?

@asvetlov
Copy link
Member Author

Replacing is another useful strategy already implemented by md.update().
I'm talking about this case:

  1. Aiohttp client session has a set of default HTTP headers.
  2. client.request() accepts headers for the concrete request.
    Default headers should be merged into passed to request() one but session defaults should not override formers.

@webknjaz
Copy link
Member

Ok, makes sense

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

No branches or pull requests

2 participants