https

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient struct {
	BaseURL string
	Headers map[string]string
}

HTTPClient 封装了HTTP客户端的功能

func New

func New() *HTTPClient

func NewUrl

func NewUrl(baseUrl string) *HTTPClient

func (*HTTPClient) AddHeader

func (c *HTTPClient) AddHeader(name, val string) *HTTPClient

func (*HTTPClient) Get

func (c *HTTPClient) Get(endpoint string) ([]byte, error)

Get 发送GET请求

func (*HTTPClient) Post

func (c *HTTPClient) Post(endpoint string, data []byte) ([]byte, error)

Post 发送POST请求

func (*HTTPClient) SetBaseUrl

func (c *HTTPClient) SetBaseUrl(baseUrl string) *HTTPClient

func (*HTTPClient) SetHeaders

func (c *HTTPClient) SetHeaders(headers map[string]string) *HTTPClient

Jump to

Keyboard shortcuts

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