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

rpc: add SetHeader method to Client #21392

Merged
merged 12 commits into from
Aug 3, 2020
Merged

Conversation

renaynay
Copy link
Contributor

Resolves #20163

rpc/http.go Outdated Show resolved Hide resolved
rpc/http.go Outdated Show resolved Hide resolved
@renaynay renaynay marked this pull request as ready for review July 31, 2020 15:14
@renaynay renaynay requested a review from holiman as a code owner July 31, 2020 15:14
@renaynay renaynay requested a review from fjl July 31, 2020 15:14
fjl added 4 commits August 3, 2020 10:20
In go-ethereum, 'mu' and 'lock' are the canonical names
for lock-typed fields.
This makes the test less reliant on client internals.
http.Header usually shouldn't be modified using map operations
because it performs canonicalization on the key strings.
@fjl fjl changed the title rpc: add SetHeaders method to Client rpc: add SetHeader method to Client Aug 3, 2020
rpc/http.go Outdated
// set headers
hc.mu.Lock()
for key, vals := range hc.headers {
req.Header.Del(key)
Copy link
Contributor Author

@renaynay renaynay Aug 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may be missing something, but why do you have to delete the key before setting the key & Vals even though the request is a fresh new request?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you're right, I got confused.

@fjl fjl merged commit 290d6bd into ethereum:master Aug 3, 2020
@fjl fjl added this to the 1.9.19 milestone Aug 4, 2020
enriquefynn pushed a commit to enriquefynn/go-ethereum that referenced this pull request Mar 10, 2021
Resolves ethereum#20163

Co-authored-by: Felix Lange <fjl@twurst.com>
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.

rpc: add support for setting HTTP headers on Client
2 participants