http

package
v0.0.0-...-1ab66c2 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeJson = "application/json"
	ContentTypeForm = "application/x-www-form-urlencoded"
)

Variables

This section is empty.

Functions

func Request

func Request(ctx context.Context, opt ...Option) (responseBody []byte, httpCode int, err error)

Types

type Option

type Option func(*Options)

func AddHeader

func AddHeader(header map[string]string) Option

func Body

func Body(data []byte) Option

func JsonBody

func JsonBody(data any) Option

func Method

func Method(method string) Option

func SetContentType

func SetContentType(contentType string) Option

func Timeout

func Timeout(timeout time.Duration) Option

func Url

func Url(u string, params ...map[string]string) Option

type Options

type Options struct {
	Url     string
	Method  string
	Header  map[string]string
	Timeout time.Duration
	Body    []byte
}

Jump to

Keyboard shortcuts

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