httputil

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeJson = `application/json`
)

Variables

View Source
var DefaultTimeout = time.Second * 5

Functions

func HttpGet

func HttpGet(url string, params url.Values, headers http.Header, timeout time.Duration) ([]byte, error)

func HttpPost

func HttpPost(dest string, body io.Reader, params url.Values, headers http.Header, timeout time.Duration) ([]byte, error)

func HttpRequest

func HttpRequest(opt Options) ([]byte, error)

func JsonPost

func JsonPost(addr string, req interface{}, resp interface{}) (err error)

Types

type Options

type Options struct {
	Params url.Values
	Header http.Header
	Body   io.Reader
	Method string
	URL    string
}

Jump to

Keyboard shortcuts

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