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

Add simple DoRequest so clients can implement auth #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

belak
Copy link

@belak belak commented Oct 20, 2017

This is so clients can implement Basic or Digest auth. The spec mentions digest auth, but the server I'm using also supports basic auth.

So, you can do something like this:

client.RequestFilter = func(req *http.Request) {
    req.SetBasicAuth("username", "password")
}

However, I'm aware this is a hack... and I'm not even sure if it can be used for Digest auth... if you have any suggestions as to a better way to do this, I'd be happy to do that instead.

@belak
Copy link
Author

belak commented Oct 23, 2017

After looking at this, I think the proper way of handling this would be to create something like client.DoRequest(req *http.Request) (*http.Response, error) so the request can be retried (for something like digest auth).

@belak belak changed the title Add simple RequestFilter so clients can implement auth Add simple DoRequest so clients can implement auth Oct 23, 2017
@michiwend
Copy link
Owner

Hej @belak I'm sorry for not getting back to you. I was quite busy and didn't look at this project in a while. I will review your PR asap! thank you very much for contributing!

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.

2 participants