Set header content type instead of overwriting all headers (#14222)

* Set header content type instead of overwriting all headers

* Add changelog file
This commit is contained in:
Joe Andaverde 2022-02-23 16:09:57 -06:00 committed by GitHub
parent 45875c7e71
commit 61313d86e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -5,7 +5,6 @@ import (
"context"
"fmt"
"io"
"net/http"
"net/url"
"os"
"strings"
@ -145,9 +144,7 @@ func (c *Logical) Write(path string, data map[string]interface{}) (*Secret, erro
func (c *Logical) JSONMergePatch(ctx context.Context, path string, data map[string]interface{}) (*Secret, error) {
r := c.c.NewRequest("PATCH", "/v1/"+path)
r.Headers = http.Header{
"Content-Type": []string{"application/merge-patch+json"},
}
r.Headers.Set("Content-Type", "application/merge-patch+json")
if err := r.SetJSONBody(data); err != nil {
return nil, err
}

3
changelog/14222.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note: bug
core/api: Fix overwriting of request headers when using JSONMergePatch.
```