wrapper

package
v0.0.64 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WrappedRequest

type WrappedRequest struct {
	*http.Request
}

func (*WrappedRequest) MarshalJSON

func (r *WrappedRequest) MarshalJSON() ([]byte, error)

MarshalJSON

func (*WrappedRequest) UnmarshalJSON

func (r *WrappedRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON

type WrappedResponse

type WrappedResponse struct {
	*http.Response
}

func (*WrappedResponse) MarshalJSON

func (r *WrappedResponse) MarshalJSON() ([]byte, error)

MarshalJSON

wrappedResponse.Body 如果是 []byte 类型, 默认值一定要是 []byte{}, 而不是 nil. 当 Body 的类型为 string 时, 空字符串 json.Marshal 后的结果就是 "". 所以这个 body 一定要用 []byte{}, 这样 json.Marshal 出来之后就是 "". nil 在 json.Marshal 后的结果是 null, 这样就与 string 类型的 Body 不匹配.

func (*WrappedResponse) UnmarshalJSON

func (r *WrappedResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL