mirror of
https://github.com/jackc/pgx.git
synced 2025-04-27 13:14:32 +00:00
Return error on MarshalJSON of status Undefined
Previously "undefined" was returned as a value. While this is a valid JavaScript value, it is not valid JSON.
This commit is contained in:
parent
a5f166bd21
commit
10fa3a6497
2
int2.go
2
int2.go
@ -202,7 +202,7 @@ func (src *Int2) MarshalJSON() ([]byte, error) {
|
|||||||
case Null:
|
case Null:
|
||||||
return []byte("null"), nil
|
return []byte("null"), nil
|
||||||
case Undefined:
|
case Undefined:
|
||||||
return []byte("undefined"), nil
|
return nil, errUndefined
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, errBadStatus
|
return nil, errBadStatus
|
||||||
|
2
int4.go
2
int4.go
@ -193,7 +193,7 @@ func (src *Int4) MarshalJSON() ([]byte, error) {
|
|||||||
case Null:
|
case Null:
|
||||||
return []byte("null"), nil
|
return []byte("null"), nil
|
||||||
case Undefined:
|
case Undefined:
|
||||||
return []byte("undefined"), nil
|
return nil, errUndefined
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, errBadStatus
|
return nil, errBadStatus
|
||||||
|
2
int8.go
2
int8.go
@ -179,7 +179,7 @@ func (src *Int8) MarshalJSON() ([]byte, error) {
|
|||||||
case Null:
|
case Null:
|
||||||
return []byte("null"), nil
|
return []byte("null"), nil
|
||||||
case Undefined:
|
case Undefined:
|
||||||
return []byte("undefined"), nil
|
return nil, errUndefined
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, errBadStatus
|
return nil, errBadStatus
|
||||||
|
2
text.go
2
text.go
@ -144,7 +144,7 @@ func (src *Text) MarshalJSON() ([]byte, error) {
|
|||||||
case Null:
|
case Null:
|
||||||
return []byte("null"), nil
|
return []byte("null"), nil
|
||||||
case Undefined:
|
case Undefined:
|
||||||
return []byte("undefined"), nil
|
return nil, errUndefined
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, errBadStatus
|
return nil, errBadStatus
|
||||||
|
Loading…
x
Reference in New Issue
Block a user