gomusicbrainz
gomusicbrainz copied to clipboard
Add simple DoRequest so clients can implement auth
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.
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).
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!