httprequest

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeJson           = "application/json"
	ContentTypeTextXml        = "text/xml"
	ContentTypeApplicationXml = "application/xml"
	ContentTypeText           = "text/"
	ContentTypeBinary         = "application/octet-stream"
	ContentTypeFormData       = "multipart/form-data"
	ContextTypeUrlEncoded     = "application/x-www-form-urlencoded"
)

Variables

This section is empty.

Functions

func ReadBody

func ReadBody(v any, r *http.Request, accept ...string) error

ReadBody reads the body of an HTTP request and decodes it into a struct v. You can include the mimetypes that are acceptable, otherwise it will read the body based on the content type.

func ReadQuery

func ReadQuery(v any, q url.Values) error

ReadQuery reads the query parameters from a URL and sets the fields of a struct v with the values. The struct v must be a pointer to a struct.

Types

This section is empty.

Jump to

Keyboard shortcuts

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