Skip to content

Add simple DoRequest so clients can implement auth#12

Open
belak wants to merge 3 commits intomichiwend:masterfrom
belak-forks:request-filter
Open

Add simple DoRequest so clients can implement auth#12
belak wants to merge 3 commits intomichiwend:masterfrom
belak-forks:request-filter

Conversation

@belak
Copy link
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
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