http_proxy

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FORMAT_STRING format = "String"
	FORMAT_JSON   format = "JSON"
)
View Source
const FORMAT_TYPE = "__FORMAT"

Variables

This section is empty.

Functions

func NewRequest

func NewRequest(method string, url string) *proxiedRequestImpl

Types

type ProxiedRequest

type ProxiedRequest interface {
	// Adds the key-value pair to the header.
	// It appends to any existing values associated with key
	AddHeader(key string, value string) ProxiedRequest
	// Applies the body to request replacing the older one if present
	SetBody(body io.Reader) ProxiedRequest
	// Set the key-value pair to the header.
	// It replaces any existing values associated with key
	SetHeader(key string, value string) ProxiedRequest
	// Set the key-value pairs to the header.
	// It replaces any existing values associated with the keys
	SetHeaders(headers map[string]string) ProxiedRequest
	// Transform the passed object into an io.Reader and applies it as body
	// of the request, replacing the older one if present
	SetJSONBody(body any) ProxiedRequest
	// It allows to set comma separated values for the provided keys
	// It replaces any existing values associated with the keys
	SetMultiValueHeaders(headers map[string][]string) ProxiedRequest
	// Adds an interceptor that is executed over the response
	WithGenericInterceptor(handlers ...errorHandler) ProxiedRequest
	// Adds an interceptor that is executed when the response status code
	// matches the provided value
	WithStatusCodeInterceptor(statusCode int, handlers ...errorHandler) ProxiedRequest
	// Generates the underlying request without sending it. After this the request
	// can't be modified or it will return an error
	UnderlyingRequest() (*http.Request, error)
	// Set the context of the request
	WithContext(ctx context.Context) ProxiedRequest
	// Generates the underlying request if not already generated and sends it
	Send() (*http.Response, error)
}

Jump to

Keyboard shortcuts

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