httputil

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const MIMEMultipartForm = "multipart/form-data"

Variables

This section is empty.

Functions

func BindData

func BindData(destination interface{}, data map[string][]string, tag string) error

bindData will bind data ONLY fields in destination struct that have EXPLICIT tag

func GetIPFromRequest

func GetIPFromRequest(ctx *http.Request) string

FromRequest returns client's real public IP address from http request headers.

func HttpBind

func HttpBind(i interface{}, req *http.Request) (err error)

Bind implements the `Binder#Bind` function.

func HttpBindQuery

func HttpBindQuery(i interface{}, req *http.Request) (err error)

func UnmarshalQuery

func UnmarshalQuery(destination any, queryString, tag string) error

Types

type HTTPError

type HTTPError struct {
	Code    int
	Message interface{}
}

func NewHTTPError

func NewHTTPError(code int, message ...interface{}) *HTTPError

func (*HTTPError) Error

func (he *HTTPError) Error() string

Jump to

Keyboard shortcuts

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