File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ var ErrInvalidParameterFormat = errors.New("invalid parameter format")
19
19
// ErrInvalidParameterValue is returned when a parameter key is invalid.
20
20
var ErrInvalidParameterValue = errors .New ("invalid parameter value" )
21
21
22
+ // ErrMissingParameters is returned when the Params structure is missing from the element.
23
+ var ErrMissingParameters = errors .New ("missing parameters" )
24
+
22
25
// NewParams creates a new ordered map.
23
26
func NewParams () * Params {
24
27
p := Params {}
@@ -74,6 +77,9 @@ func (p *Params) Names() []string {
74
77
// marshalSFV serializes as defined in
75
78
// https://httpwg.org/specs/rfc8941.html#ser-params.
76
79
func (p * Params ) marshalSFV (b * strings.Builder ) error {
80
+ if p == nil {
81
+ return ErrMissingParameters
82
+ }
77
83
for _ , k := range p .names {
78
84
if err := b .WriteByte (';' ); err != nil {
79
85
return err
You can’t perform that action at this time.
0 commit comments