Use maps.Copy for simpler map handling (#7009)

Signed-off-by: eveneast <qcqs@foxmail.com>
This commit is contained in:
eveneast
2025-05-14 05:16:47 +08:00
committed by GitHub
parent 8524386737
commit a76d005a94
3 changed files with 9 additions and 18 deletions

View File

@ -24,6 +24,7 @@ import (
"io"
"io/fs"
"log"
"maps"
"net"
"net/http"
"os"
@ -703,9 +704,7 @@ func AdminAPIRequest(adminAddr, method, uri string, headers http.Header, body io
if body != nil {
req.Header.Set("Content-Type", "application/json")
}
for k, v := range headers {
req.Header[k] = v
}
maps.Copy(req.Header, headers)
// make an HTTP client that dials our network type, since admin
// endpoints aren't always TCP, which is what the default transport