MCPcopy Index your code
hub / github.com/dunglas/httpsfv / marshalSFV

Method marshalSFV

params.go:79–107  ·  view source on GitHub ↗

marshalSFV serializes as defined in https://httpwg.org/specs/rfc9651.html#ser-params.

(b *strings.Builder)

Source from the content-addressed store, hash-verified

77// marshalSFV serializes as defined in
78// https://httpwg.org/specs/rfc9651.html#ser-params.
79func (p *Params) marshalSFV(b *strings.Builder) error {
80 if p == nil {
81 return ErrMissingParameters
82 }
83 for _, k := range p.names {
84 if err := b.WriteByte(';'); err != nil {
85 return err
86 }
87
88 if err := marshalKey(b, k); err != nil {
89 return err
90 }
91
92 v := p.values[k]
93 if v == true {
94 continue
95 }
96
97 if err := b.WriteByte('='); err != nil {
98 return err
99 }
100
101 if err := marshalBareItem(b, v); err != nil {
102 return err
103 }
104 }
105
106 return nil
107}
108
109// parseParams parses as defined in
110// https://httpwg.org/specs/rfc9651.html#parse-param.

Callers 1

TestMarshalParametersFunction · 0.95

Calls 2

marshalKeyFunction · 0.85
marshalBareItemFunction · 0.85

Tested by 1

TestMarshalParametersFunction · 0.76