fixed panic due to concurrent map writes

Fixes #36
This commit is contained in:
Jarek Kowalski
2020-08-17 19:47:58 -07:00
committed by Christoph Polcin
parent 9380631c29
commit 617404b525
4 changed files with 27 additions and 16 deletions

View File

@@ -2,6 +2,7 @@ package gowebdav
import (
"encoding/base64"
"net/http"
)
// BasicAuth structure holds our credentials
@@ -26,8 +27,8 @@ func (b *BasicAuth) Pass() string {
}
// Authorize the current request
func (b *BasicAuth) Authorize(c *Client, method string, path string) {
func (b *BasicAuth) Authorize(req *http.Request, method string, path string) {
a := b.user + ":" + b.pw
auth := "Basic " + base64.StdEncoding.EncodeToString([]byte(a))
c.headers.Set("Authorization", auth)
req.Header.Set("Authorization", auth)
}