httpclient

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: MIT Imports: 23 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	PATH                                        = "path"
	URL                                         = "url"
	URLENCODE_BODY                              = "url_encode_body"
	BASEURL                                     = "base_url"
	METHOD                                      = "method"
	BODY                                        = "body"
	HEADER                                      = "header"
	QUERYPARAMS                                 = "query_params"
	USE_SSE                                     = "use_sse"
	SSE_METHOD_POST                             = "sse_method_post"
	SCHEME                                      = "scheme"
	HOST                                        = "host"
	UNDEFINED_VARIABLES                         = "undefined"
	FORWARDED_CLIENT_HEADER_NAMES               = "forwarded_client_header_names"
	FORWARDED_CLIENT_HEADER_REGULAR_EXPRESSIONS = "forwarded_client_header_regular_expressions"
	TRACE                                       = "__trace__"
	WsSubProtocol                               = "ws_sub_protocol"
)
View Source
const (
	ContentEncodingHeader = "Content-Encoding"
	AcceptEncodingHeader  = "Accept-Encoding"
	AcceptHeader          = "Accept"
	ContentTypeHeader     = "Content-Type"

	EncodingGzip    = "gzip"
	EncodingDeflate = "deflate"

	ContentTypeJSON = "application/json"
)

Variables

View Source
var (
	DefaultNetHttpClient = &http.Client{
		Timeout: time.Second * 10,
		Transport: &http.Transport{
			MaxIdleConnsPerHost: 1024,
			TLSHandshakeTimeout: 0 * time.Second,
		},
	}
)

Functions

func BodyHashFromContext

func BodyHashFromContext(ctx context.Context) (uint64, bool)

func Do

func Do(client *http.Client, ctx context.Context, requestInput []byte, out *bytes.Buffer) (err error)

func DoMultipartForm

func DoMultipartForm(
	client *http.Client, ctx context.Context, requestInput []byte, files []*FileUpload, out *bytes.Buffer,
) (err error)

func GetSubscriptionInput

func GetSubscriptionInput(input []byte) (url, header, body []byte)

func IsInputFlagSet

func IsInputFlagSet(input []byte, flagName string) bool

func SetForwardedClientHeaderNames

func SetForwardedClientHeaderNames(input, headers []byte) []byte

func SetForwardedClientHeaderRegularExpressions

func SetForwardedClientHeaderRegularExpressions(input, headers []byte) []byte

func SetInputBody

func SetInputBody(input, body []byte) []byte

func SetInputBodyWithPath

func SetInputBodyWithPath(input, body []byte, path string) []byte

func SetInputFlag

func SetInputFlag(input []byte, flagName string) []byte

func SetInputHeader

func SetInputHeader(input, headers []byte) []byte

func SetInputHost

func SetInputHost(input, host []byte) []byte

func SetInputMethod

func SetInputMethod(input, method []byte) []byte

func SetInputPath

func SetInputPath(input, path []byte) []byte

func SetInputQueryParams

func SetInputQueryParams(input, queryParams []byte) []byte

func SetInputScheme

func SetInputScheme(input, scheme []byte) []byte

func SetInputURL

func SetInputURL(input, url []byte) []byte

func SetInputURLEncodeBody

func SetInputURLEncodeBody(input []byte, urlEncodeBody bool) []byte

func SetInputWSSubprotocol

func SetInputWSSubprotocol(input, wsSubProtocol []byte) []byte

func SetUndefinedVariables

func SetUndefinedVariables(data []byte, undefinedVariables []string) ([]byte, error)

func UndefinedVariables

func UndefinedVariables(data []byte) []string

Types

type FileUpload

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

func NewFileUpload

func NewFileUpload(path string, name string, variablePath string) *FileUpload

func (*FileUpload) Name

func (f *FileUpload) Name() string

func (*FileUpload) Path

func (f *FileUpload) Path() string

func (*FileUpload) SetVariablePath

func (f *FileUpload) SetVariablePath(variablePath string)

func (*FileUpload) VariablePath

func (f *FileUpload) VariablePath() string

type ResponseContext

type ResponseContext struct {
	StatusCode int
	Request    *http.Request
	Response   *http.Response
}

func InjectResponseContext

func InjectResponseContext(ctx context.Context) (context.Context, *ResponseContext)

type TraceHTTP

type TraceHTTP struct {
	Request  TraceHTTPRequest  `json:"request"`
	Response TraceHTTPResponse `json:"response"`
}

type TraceHTTPRequest

type TraceHTTPRequest struct {
	Method  string      `json:"method"`
	URL     string      `json:"url"`
	Headers http.Header `json:"headers"`
}

type TraceHTTPResponse

type TraceHTTPResponse struct {
	StatusCode int         `json:"status_code"`
	Status     string      `json:"status"`
	Headers    http.Header `json:"headers"`
	BodySize   int         `json:"body_size"`
}

Jump to

Keyboard shortcuts

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