Allow paging cursor to decode string when needed
This commit is contained in:
@@ -200,8 +200,19 @@ func (p *PagingCursor) UnmarshalJSON(in []byte) error {
|
||||
R bool
|
||||
LT bool
|
||||
}
|
||||
|
||||
err error
|
||||
)
|
||||
|
||||
// Decode the the string if it's not a JSON
|
||||
if in[0] != byte('{') {
|
||||
s := string(in)
|
||||
in, err = base64.StdEncoding.DecodeString(s[1 : len(s)-1])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(in, &aux); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user