httpx

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

* @Author: cnzf1 * @Date: 2021-07-19 12:00:32 * @LastEditors: cnzf1 * @LastEditTime: 2022-12-14 17:40:38 * @Description:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIP

func GetIP(r *http.Request) string

GetIP returns request real ip.

func WithHeaders

func WithHeaders(headers map[string]string) httpxOption

func WithJSONContent

func WithJSONContent() httpxOption

func WithParams

func WithParams(params map[string]string) httpxOption

Types

type HttpxClient

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

func Client

func Client() *HttpxClient

func (*HttpxClient) Get

func (h *HttpxClient) Get(url string, opts ...httpxOption) ([]byte, error)

func (*HttpxClient) GetJSON

func (h *HttpxClient) GetJSON(url string, opts ...httpxOption) ([]byte, error)

func (*HttpxClient) GetToMap

func (h *HttpxClient) GetToMap(url string, opts ...httpxOption) (map[string]interface{}, error)

func (*HttpxClient) GetToMapWithTimeOut

func (h *HttpxClient) GetToMapWithTimeOut(url string, timeout time.Duration, opts ...httpxOption) (map[string]interface{}, error)

func (*HttpxClient) GetWithTimeOut

func (h *HttpxClient) GetWithTimeOut(url string, timeout time.Duration, opts ...httpxOption) ([]byte, error)

func (*HttpxClient) Post

func (h *HttpxClient) Post(url string, body interface{}, opts ...httpxOption) ([]byte, error)

func (*HttpxClient) PostJSON

func (h *HttpxClient) PostJSON(url string, body interface{}, opts ...httpxOption) ([]byte, error)

func (*HttpxClient) PostToMap

func (h *HttpxClient) PostToMap(url string, body interface{}, opts ...httpxOption) (map[string]interface{}, error)

func (*HttpxClient) PostToMapWithTimeOut

func (h *HttpxClient) PostToMapWithTimeOut(url string, body interface{}, timeout time.Duration, opts ...httpxOption) (map[string]interface{}, error)

func (*HttpxClient) PostWithOptions

func (h *HttpxClient) PostWithOptions(url string, timeout time.Duration, body interface{}, opts ...httpxOption) ([]byte, error)

Jump to

Keyboard shortcuts

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