request

package
v0.0.4-alpha Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetParsedQueryParamOrDefault

func GetParsedQueryParamOrDefault[T parser.ParseType](r *http.Request, key string, defaultValue T) T

func GetPathParam

func GetPathParam(r *http.Request, key string) string

GetPathParam gets a path parameter

func GetPathParamOrDefault

func GetPathParamOrDefault(r *http.Request, key, defaultValue string) string

GetPathParamOrDefault gets a path parameter with default value

func GetQueryParam

func GetQueryParam(r *http.Request, key string) string

GetQueryParam gets a query parameter

func GetQueryParamOrDefault

func GetQueryParamOrDefault(r *http.Request, key, defaultValue string) string

GetQueryParamOrDefault gets a query parameter with default value

func GetUploadedFile

func GetUploadedFile(r *http.Request, field string, maxMultipartFormSize int64) ([]*multipart.FileHeader, error)

func ReadUploadedFile

func ReadUploadedFile(r *http.Request, field string, maxMultipartFormSize int64) ([]byte, error)

func ReadUploadedFiles

func ReadUploadedFiles(r *http.Request, field string, maxMultipartFormSize int64) ([][]byte, error)

Types

type Builder

type Builder interface {
	WithContext(ctx context.Context) Builder
	WithMethod(method string) Builder
	WithURL(url string) Builder
	WithHeader(key, value string) Builder
	WithFormFile(key string, file *UploadedFile) Builder
	WithFormField(key, value string) Builder
	WithBodyJSON(body any) Builder
	Build() (*http.Request, error)
}

func NewBuilder

func NewBuilder(ctx context.Context, method string, url string) Builder

type Handler

type Handler func(w http.ResponseWriter, r *http.Request)

Handler is a function that handles a request

type UploadedFile

type UploadedFile struct {
	Content     []byte
	Name        string
	ContentType string
}

func NewUploadedFile

func NewUploadedFile(content []byte, name string, contentType string) *UploadedFile

Jump to

Keyboard shortcuts

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