MCPcopy Index your code
hub / github.com/coder/coder / marshalCustomHeaders

Function marshalCustomHeaders

coderd/mcp.go:1302–1311  ·  view source on GitHub ↗

marshalCustomHeaders encodes a map of custom headers to JSON for database storage. A nil map produces an empty JSON object.

(headers map[string]string)

Source from the content-addressed store, hash-verified

1300// marshalCustomHeaders encodes a map of custom headers to JSON for
1301// database storage. A nil map produces an empty JSON object.
1302func marshalCustomHeaders(headers map[string]string) (string, error) {
1303 if headers == nil {
1304 return "{}", nil
1305 }
1306 encoded, err := json.Marshal(headers)
1307 if err != nil {
1308 return "", err
1309 }
1310 return string(encoded), nil
1311}
1312
1313// trimStringSlice trims whitespace from each element and drops empty
1314// strings.

Callers 2

createMCPServerConfigMethod · 0.85
updateMCPServerConfigMethod · 0.85

Calls 1

MarshalMethod · 0.45

Tested by

no test coverage detected