mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-03 03:58:01 +00:00
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:
@@ -5,7 +5,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"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) {
|
func (c *Logical) JSONMergePatch(ctx context.Context, path string, data map[string]interface{}) (*Secret, error) {
|
||||||
r := c.c.NewRequest("PATCH", "/v1/"+path)
|
r := c.c.NewRequest("PATCH", "/v1/"+path)
|
||||||
r.Headers = http.Header{
|
r.Headers.Set("Content-Type", "application/merge-patch+json")
|
||||||
"Content-Type": []string{"application/merge-patch+json"},
|
|
||||||
}
|
|
||||||
if err := r.SetJSONBody(data); err != nil {
|
if err := r.SetJSONBody(data); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
3
changelog/14222.txt
Normal file
3
changelog/14222.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
```release-note: bug
|
||||||
|
core/api: Fix overwriting of request headers when using JSONMergePatch.
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user