builder

package
v0.0.0-...-bab1744 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(b *builder) (*http.Request, error)

func NewBuilder

func NewBuilder(method string) *builder

Types

type Option

type Option = func(*builder)

Option is a function that modifies the builder.

func BaseUrl

func BaseUrl(v string) Option

BaseUrl sets the base URL for the request.

func Body

func Body(v *io.Reader) Option

Body sets the body of the request from an io.Reader.

func BodyBytes

func BodyBytes(v []byte) Option

BodyBytes sets the body of the request from a byte slice.

func BodyString

func BodyString(v string) Option

BodyString sets the body of the request from a string.

func Context

func Context(v context.Context) Option

Context sets the context for the request.

func Cookie(v *http.Cookie) Option

Cookie adds a cookie to the request.

func Header(k, v string) Option

Header adds a header to the request.

func Host

func Host(v string) Option

Host sets the host for the request.

func Path

func Path(v string, args ...interface{}) Option

Path sets the path for the request, with optional formatting arguments.

func Port

func Port(v int) Option

Port sets the port for the request as an integer.

func PortString

func PortString(v string) Option

PortString sets the port for the request as a string.

func Query

func Query(k, v string) Option

Query adds a query parameter to the request.

func Scheme

func Scheme(v string) Option

Scheme sets the URL scheme (http or https) for the request.

Jump to

Keyboard shortcuts

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