Registry /
serialization / mozillazg-go-httpheader
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
httpheader
✓ github.com/mozillazg/go-httpheader
Encode a struct into http.Header fields
package main
import (
"fmt"
"net/http"
"github.com/mozillazg/go-httpheader"
)
type Options struct {
ContentType string `header:"Content-Type"`
Auth string `header:"Authorization"`
}
func main() {
opts := Options{ContentType: "application/json", Auth: "Bearer token"}
h := http.Header{}
httpheader.Header(&h, opts)
fmt.Println(h)
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
0.4.0latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.