gomusicbrainz icon indicating copy to clipboard operation
gomusicbrainz copied to clipboard

Add simple DoRequest so clients can implement auth

Open belak opened this issue 6 years ago • 2 comments

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 avatar Oct 20 '17 08:10 belak

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 avatar Oct 23 '17 23:10 belak

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!

michiwend avatar Oct 12 '18 08:10 michiwend