gg_net_http

package
v0.2.86 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: BSD-3-Clause Imports: 12 Imported by: 8

Documentation

Index

Constants

View Source
const MethodDelete = "DELETE"
View Source
const MethodGet = "GET"
View Source
const MethodPost = "POST"
View Source
const MethodPut = "PUT"

Variables

This section is empty.

Functions

func HttpHeaderToMap

func HttpHeaderToMap(header http.Header) map[string]string

func ReadClientCharset

func ReadClientCharset(r *http.Request) (response string)

func ReadClientCookies

func ReadClientCookies(r *http.Request) (response []*http.Cookie)

func ReadClientEncoding

func ReadClientEncoding(r *http.Request) (response string)

func ReadClientIP

func ReadClientIP(r *http.Request) (response string)

func ReadClientLang

func ReadClientLang(r *http.Request) (response string)

func ReadClientUserAgent

func ReadClientUserAgent(r *http.Request) (response string)

func ReadPayload

func ReadPayload(rawPayload interface{}) io.Reader

Types

type HttpClient

type HttpClient struct {
	// contains filtered or unexported fields
}

func NewHttpClient

func NewHttpClient(options ...*HttpClientOptions) *HttpClient

func (*HttpClient) AddHeader

func (instance *HttpClient) AddHeader(key, value string)

func (*HttpClient) Delete

func (instance *HttpClient) Delete(url string, body interface{}) (response *ResponseData, err error)

func (*HttpClient) Get

func (instance *HttpClient) Get(url string) (response *ResponseData, err error)

func (*HttpClient) Post

func (instance *HttpClient) Post(url string, body interface{}) (response *ResponseData, err error)

func (*HttpClient) Put

func (instance *HttpClient) Put(url string, body interface{}) (response *ResponseData, err error)

func (*HttpClient) RemoveHeader

func (instance *HttpClient) RemoveHeader(key string)

func (*HttpClient) Upload

func (instance *HttpClient) Upload(url string, filename, optParamName string, optParams map[string]interface{}) (*ResponseData, error)

func (*HttpClient) UploadTimeout

func (instance *HttpClient) UploadTimeout(url string, filename, optParamName string, optParams map[string]interface{}, timeout time.Duration) (*ResponseData, error)

type HttpClientOptions

type HttpClientOptions struct {
	InsecureSkipVerify bool
	Timeout            time.Duration
	Header             map[string]string
}

type ResponseData

type ResponseData struct {
	StatusCode int
	Body       []byte
	Header     map[string]string
}

func NewResponseData

func NewResponseData(res *http.Response) (instance *ResponseData, err error)

func NewResponseDataEmpty

func NewResponseDataEmpty() *ResponseData

func (*ResponseData) BodyAsMap

func (instance *ResponseData) BodyAsMap() map[string]interface{}

func (*ResponseData) String

func (instance *ResponseData) String() string

Jump to

Keyboard shortcuts

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