httpreq

package
v0.39.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CodeIs200

func CodeIs200(code int) error

func Do

func Do[R any](
	client *http.Client,
	method string,
	link string,
	reader io.Reader,
	codeChecker CodeChecker,
	extractResult ResultExtractor[R],
) (R, error)

func JSONExtractor

func JSONExtractor[R any](data []byte) (R, error)

func XMLExtractor

func XMLExtractor[R any](data []byte) (R, error)

Types

type CodeChecker

type CodeChecker func(code int) error

type HeaderAndReader added in v0.15.2

type HeaderAndReader struct {
	// contains filtered or unexported fields
}

func NewHeaderAndReader added in v0.15.2

func NewHeaderAndReader(
	r io.Reader,
	header http.Header,
) *HeaderAndReader

func (*HeaderAndReader) Header added in v0.15.2

func (hr *HeaderAndReader) Header() http.Header

func (*HeaderAndReader) Read added in v0.15.2

func (hr *HeaderAndReader) Read(p []byte) (n int, err error)

type ResultExtractor

type ResultExtractor[R any] func(data []byte) (R, error)

Jump to

Keyboard shortcuts

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