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

allow header and set header in client #222

Merged
merged 2 commits into from
Feb 12, 2022

Conversation

hunjixin
Copy link
Contributor

@hunjixin hunjixin commented Dec 16, 2021

need send Authorization header to remote exec cmds.
allow header and support set header value in client

@welcome
Copy link

welcome bot commented Dec 16, 2021

Thank you for submitting this PR!
A maintainer will be here shortly to review it.
We are super grateful, but we are also overloaded! Help us by making sure that:

  • The context for this PR is clear, with relevant discussion, decisions
    and stakeholders linked/mentioned.

  • Your contribution itself is clear (code comments, self-review for the
    rest) and in its best form. Follow the code contribution
    guidelines

    if they apply.

Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
Next steps:

  • A maintainer will triage and assign priority to this PR, commenting on
    any missing things and potentially assigning a reviewer for high
    priority items.

  • The PR gets reviews, discussed and approvals as needed.

  • The PR is merged by maintainers when it has been approved and comments addressed.

We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution.
We are very grateful for your contribution!

@hunjixin
Copy link
Contributor Author

@Stebalien

@hunjixin
Copy link
Contributor Author

anyone can review this pr?

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

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

The change seems reasonable, but please add a test in http/client_test.go (see the first test as a good example).

http/config.go Show resolved Hide resolved
http/client.go Outdated Show resolved Hide resolved
@BigLep
Copy link

BigLep commented Jan 7, 2022

@hunjixin: are you able to add the test so we can get this merged?

@BigLep BigLep added the need/author-input Needs input from the original author label Jan 7, 2022
@hunjixin
Copy link
Contributor Author

@BigLep have tested

@aschmahmann aschmahmann added need/maintainer-input Needs input from the current maintainer(s) and removed need/author-input Needs input from the original author labels Jan 14, 2022
@BigLep
Copy link

BigLep commented Jan 14, 2022

Thanks. We're blocked on finding maintainer review time. It's in the queue though.

Comment on lines +44 to +45
// ClientWithHeaders specifies the HTTP header for the client.
func ClientWithHeaders(key, value string) ClientOpt {
Copy link
Member

Choose a reason for hiding this comment

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

nit

Suggested change
// ClientWithHeaders specifies the HTTP header for the client.
func ClientWithHeaders(key, value string) ClientOpt {
// ClientWithHeader adds an HTTP header to the client.
func ClientWithHeader(key, value string) ClientOpt {

testClient := s.Client()
tc.host = s.URL
r := &cmds.Request{Path: tc.path, Command: &cmds.Command{}, Root: &cmds.Command{}}
c := NewClient(tc.host, ClientWithHeaders(tc.header, tc.value)).(*client)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
c := NewClient(tc.host, ClientWithHeaders(tc.header, tc.value)).(*client)
c := NewClient(tc.host, ClientWithHeader(tc.header, tc.value)).(*client)

@Stebalien Stebalien merged commit 9c9c23d into ipfs:master Feb 12, 2022
@Stebalien
Copy link
Member

Merged in #226 (addressing my review). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/maintainer-input Needs input from the current maintainer(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants