httputil

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentSubtype

func ContentSubtype(contentType string) string

ContentSubtype returns the content-subtype for the given content-type. The given content-type must be a valid content-type that starts with but no content-subtype will be returned. according rfc7231. contentType is assumed to be lowercase already.

func ContentType

func ContentType(subtype string) string

ContentType returns the content-type with base prefix.

func ResetContentType

func ResetContentType(subtype, fullType string)

Types

type Body

type Body interface {
	GetStatus() int32
	GetHeader() map[string]string
	GetResult() []byte
}

func Request

func Request(method string, url string, data []byte, opts ...Option) (body Body, err error)

type Option

type Option func(o *options)

func WithClient

func WithClient(client *http.Client) Option

func WithContentType added in v0.1.32

func WithContentType(contentType string) Option

func WithContentTypeFormData

func WithContentTypeFormData(boundary string) Option

func WithContentTypeJson

func WithContentTypeJson() Option

func WithContentTypeUrlencoded

func WithContentTypeUrlencoded() Option

func WithHeader

func WithHeader(name string, val ...string) Option

func WithTLS

func WithTLS(tlsCert *tls.ConnectionState) Option

Jump to

Keyboard shortcuts

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