Skip to content

Commit

Permalink
encode and send DeleteKeyRequest body
Browse files Browse the repository at this point in the history
This commit fixes a bug in `DeleteKey`. The `DeleteKeyRequest`
body has to be encoded and sent to the server.

Signed-off-by: Andreas Auernhammer <[email protected]>
  • Loading branch information
aead committed Dec 18, 2023
1 parent bdecb31 commit 614cf96
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kms/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -588,11 +588,16 @@ func (c *Client) DeleteKey(ctx context.Context, req *DeleteKeyRequest) error {
ContentType = headers.ContentTypeAppAny // accept JSON or protobuf
)

body, err := pb.Marshal(req)
if err != nil {
return err
}

url, err := c.lb.URL(Path, req.Name)
if err != nil {
return err
}
r, err := http.NewRequestWithContext(ctx, Method, url, nil)
r, err := http.NewRequestWithContext(ctx, Method, url, bytes.NewReader(body))
if err != nil {
return err
}
Expand Down

0 comments on commit 614cf96

Please sign in to comment.