MCPcopy Create free account
hub / github.com/tus/tusd / SerializeMetadataHeader

Function SerializeMetadataHeader

pkg/handler/unrouted_handler.go:1617–1630  ·  view source on GitHub ↗

SerializeMetadataHeader serializes a map of strings into the Upload-Metadata header format used in the response for HEAD requests. e.g. Upload-Metadata: name bHVucmpzLnBuZw==,type aW1hZ2UvcG5n

(meta map[string]string)

Source from the content-addressed store, hash-verified

1615// header format used in the response for HEAD requests.
1616// e.g. Upload-Metadata: name bHVucmpzLnBuZw==,type aW1hZ2UvcG5n
1617func SerializeMetadataHeader(meta map[string]string) string {
1618 header := ""
1619 for key, value := range meta {
1620 valueBase64 := base64.StdEncoding.EncodeToString([]byte(value))
1621 header += key + " " + valueBase64 + ","
1622 }
1623
1624 // Remove trailing comma
1625 if len(header) > 0 {
1626 header = header[:len(header)-1]
1627 }
1628
1629 return header
1630}
1631
1632// Parse the Upload-Concat header, e.g.
1633// Upload-Concat: partial

Callers 1

HeadFileMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…