request

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyHeaders added in v0.0.8

func CopyHeaders(dest map[string][]string, source map[string][]string)

Copies source headers into destination (deep copy)

func CopyMap added in v0.0.8

func CopyMap(dest map[string]any, source map[string]any)

Copies source map into destination (deep copy)

func GetReqHeaders

func GetReqHeaders(req *http.Request) map[string][]string

Get headers from request

func GetResHeaders added in v0.0.5

func GetResHeaders(res *http.Response) map[string][]string

Get headers from response

func ParseHeaders

func ParseHeaders(headers map[string][]string) map[string]any

Parse headers into `map[string]any`

func ParseReqURL added in v0.0.5

func ParseReqURL(req *http.Request) (*url.URL, error)

Outputs a URL object with fields populated from the request

func ReadReqBody added in v0.0.5

func ReadReqBody(req *http.Request) ([]byte, error)

Read body from request

func ReadResBody added in v0.0.5

func ReadResBody(res *http.Response) ([]byte, error)

Read body from response

Types

type Body

type Body struct {
	Data  map[string]any
	Raw   []byte
	Empty bool
}

func CreateBody

func CreateBody(data map[string]any) (Body, error)

Create new body with data

func GetReqBody

func GetReqBody(req *http.Request) (Body, error)

Get body from request

func GetResBody added in v0.0.5

func GetResBody(res *http.Response) (Body, error)

Get body from response

func (Body) ToString

func (body Body) ToString() string

Body to string

func (*Body) UpdateReq added in v0.0.6

func (body *Body) UpdateReq(req *http.Request) error

Update body in request

func (*Body) UpdateRes added in v0.0.6

func (body *Body) UpdateRes(res *http.Response) error

Update body in response

func (*Body) Write

func (body *Body) Write(w http.ResponseWriter) error

Write body into response writer

type BodyType

type BodyType string
const (
	Json    BodyType = "Json"
	Form    BodyType = "Form"
	Unknown BodyType = "Unknown"
)

Jump to

Keyboard shortcuts

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