docker: avoid concurrent map access panic
@@ -521,7 +521,10 @@ func (r *request) do(ctx context.Context) (*http.Response, error) {
if err != nil {
return nil, err
}
- req.Header = r.header
+ req.Header = http.Header{} // headers need to be copied to avoid concurrent map access
+ for k, v := range r.header {
+ req.Header[k] = v
+ }
if r.body != nil {
body, err := r.body()
if err != nil {
