MarshalJSON implements json.Marshaler for Header.
()
| 32 | |
| 33 | // MarshalJSON implements json.Marshaler for Header. |
| 34 | func (h Header) MarshalJSON() ([]byte, error) { |
| 35 | if len(h) == 0 { |
| 36 | return nil, nil |
| 37 | } |
| 38 | b, err := json.Marshal(map[string]interface{}(h)) |
| 39 | if err != nil { |
| 40 | return nil, err |
| 41 | } |
| 42 | return EncodeEscape(b), nil |
| 43 | } |
| 44 | |
| 45 | // Base64 implements the Encoder interface. |
| 46 | func (h Header) Base64() ([]byte, error) { |