http

package
v1.8.6 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: Apache-2.0 Imports: 11 Imported by: 17

Documentation

Index

Constants

View Source
const (
	GET     = http.MethodGet
	POST    = http.MethodPost
	HEAD    = http.MethodHead
	PUT     = http.MethodPut
	PATCH   = http.MethodPatch // RFC 5789
	DELETE  = http.MethodDelete
	CONNECT = http.MethodConnect
	OPTIONS = http.MethodOptions
	TRACE   = http.MethodTrace

	ContentEncoding = "Content-Encoding"
	LastModified    = "Last-Modified"
	IfModifiedSince = "If-Modified-Since"
)

Variables

View Source
var (
	TimeZero = time.Unix(0, 0)
)

Functions

func HttpGet

func HttpGet(url string) ([]byte, error)

func HttpRequest

func HttpRequest(url string, method string) ([]byte, error)

func Request

func Request(url string, method string, header ...map[string]any) (data []byte, lastModified time.Time, err error)

Request http request, 支持传入header

Types

type Response

type Response struct {
	StatusCode    int
	ContentLength int
	LastModified  time.Time
	Body          []byte
}

Jump to

Keyboard shortcuts

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