httputils

package
v0.12.7 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package httputils implements HTTP related utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsHandled

func IsHandled(mux *http.ServeMux, url string) bool

func NewRequest added in v0.12.7

func NewRequest(method, url string, reqBody *RequestBody) (*http.Request, error)

NewRequest returns a new HTTP request object, with the given method, url, request body.

Types

type RequestBody added in v0.12.7

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

RequestBody returns a reusable HTTP request body if its size is smaller than largeBodyThreshold. This is the most common use case in probing. If the body is larger than largeBodyThreshold, it returns a buffered reader. We do that because HTTP transport reads limited bytes at a time.

func NewRequestBody added in v0.12.7

func NewRequestBody(data ...string) *RequestBody

NewRequestBody returns a new RequestBody object.

func (*RequestBody) Buffered added in v0.12.7

func (rb *RequestBody) Buffered() bool

func (*RequestBody) ContentType added in v0.12.7

func (rb *RequestBody) ContentType() string

func (*RequestBody) Len added in v0.12.7

func (rb *RequestBody) Len() int64

func (*RequestBody) Read added in v0.12.7

func (rb *RequestBody) Read(p []byte) (int, error)

func (*RequestBody) Reader added in v0.12.7

func (rb *RequestBody) Reader() io.ReadCloser

Jump to

Keyboard shortcuts

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