Versions in this module Expand all Collapse all v0 v0.2.0 Sep 12, 2022 Changes in this version + func NewBindingError(sourceParam string, values []string, message string, err error) error + type BindUnmarshaler interface + UnmarshalParam func(param string) error + type BindingError struct + Field string + Values []string + func (be *BindingError) Error() string + type DefaultRequestBinder struct + func (b *DefaultRequestBinder) Bind(req *Request, v any) error + func (b *DefaultRequestBinder) BindBody(req *Request, i any) (err error) + func (b *DefaultRequestBinder) BindQueryParams(req *Request, i any) error + type ValueBinder struct + ErrorFunc func(sourceParam string, values []string, message string, err error) error + ValueFunc func(sourceParam string) string + ValuesFunc func(sourceParam string) []string + func FormParamsBinder(req *Request) *ValueBinder + func QueryParamsBinder(req *Request) *ValueBinder + func (b *ValueBinder) BindError() error + func (b *ValueBinder) BindErrors() []error + func (b *ValueBinder) BindUnmarshaler(sourceParam string, dest BindUnmarshaler) *ValueBinder + func (b *ValueBinder) BindWithDelimiter(sourceParam string, dest any, delimiter string) *ValueBinder + func (b *ValueBinder) Bool(sourceParam string, dest *bool) *ValueBinder + func (b *ValueBinder) Bools(sourceParam string, dest *[]bool) *ValueBinder + func (b *ValueBinder) Byte(sourceParam string, dest *byte) *ValueBinder + func (b *ValueBinder) CustomFunc(sourceParam string, customFunc func(values []string) []error) *ValueBinder + func (b *ValueBinder) Duration(sourceParam string, dest *time.Duration) *ValueBinder + func (b *ValueBinder) Durations(sourceParam string, dest *[]time.Duration) *ValueBinder + func (b *ValueBinder) FailFast(value bool) *ValueBinder + func (b *ValueBinder) Float32(sourceParam string, dest *float32) *ValueBinder + func (b *ValueBinder) Float32s(sourceParam string, dest *[]float32) *ValueBinder + func (b *ValueBinder) Float64(sourceParam string, dest *float64) *ValueBinder + func (b *ValueBinder) Float64s(sourceParam string, dest *[]float64) *ValueBinder + func (b *ValueBinder) Int(sourceParam string, dest *int) *ValueBinder + func (b *ValueBinder) Int16(sourceParam string, dest *int16) *ValueBinder + func (b *ValueBinder) Int16s(sourceParam string, dest *[]int16) *ValueBinder + func (b *ValueBinder) Int32(sourceParam string, dest *int32) *ValueBinder + func (b *ValueBinder) Int32s(sourceParam string, dest *[]int32) *ValueBinder + func (b *ValueBinder) Int64(sourceParam string, dest *int64) *ValueBinder + func (b *ValueBinder) Int64s(sourceParam string, dest *[]int64) *ValueBinder + func (b *ValueBinder) Int8(sourceParam string, dest *int8) *ValueBinder + func (b *ValueBinder) Int8s(sourceParam string, dest *[]int8) *ValueBinder + func (b *ValueBinder) Ints(sourceParam string, dest *[]int) *ValueBinder + func (b *ValueBinder) MustBindUnmarshaler(sourceParam string, dest BindUnmarshaler) *ValueBinder + func (b *ValueBinder) MustBindWithDelimiter(sourceParam string, dest any, delimiter string) *ValueBinder + func (b *ValueBinder) MustBool(sourceParam string, dest *bool) *ValueBinder + func (b *ValueBinder) MustBools(sourceParam string, dest *[]bool) *ValueBinder + func (b *ValueBinder) MustByte(sourceParam string, dest *byte) *ValueBinder + func (b *ValueBinder) MustCustomFunc(sourceParam string, customFunc func(values []string) []error) *ValueBinder + func (b *ValueBinder) MustDuration(sourceParam string, dest *time.Duration) *ValueBinder + func (b *ValueBinder) MustDurations(sourceParam string, dest *[]time.Duration) *ValueBinder + func (b *ValueBinder) MustFloat32(sourceParam string, dest *float32) *ValueBinder + func (b *ValueBinder) MustFloat32s(sourceParam string, dest *[]float32) *ValueBinder + func (b *ValueBinder) MustFloat64(sourceParam string, dest *float64) *ValueBinder + func (b *ValueBinder) MustFloat64s(sourceParam string, dest *[]float64) *ValueBinder + func (b *ValueBinder) MustInt(sourceParam string, dest *int) *ValueBinder + func (b *ValueBinder) MustInt16(sourceParam string, dest *int16) *ValueBinder + func (b *ValueBinder) MustInt16s(sourceParam string, dest *[]int16) *ValueBinder + func (b *ValueBinder) MustInt32(sourceParam string, dest *int32) *ValueBinder + func (b *ValueBinder) MustInt32s(sourceParam string, dest *[]int32) *ValueBinder + func (b *ValueBinder) MustInt64(sourceParam string, dest *int64) *ValueBinder + func (b *ValueBinder) MustInt64s(sourceParam string, dest *[]int64) *ValueBinder + func (b *ValueBinder) MustInt8(sourceParam string, dest *int8) *ValueBinder + func (b *ValueBinder) MustInt8s(sourceParam string, dest *[]int8) *ValueBinder + func (b *ValueBinder) MustInts(sourceParam string, dest *[]int) *ValueBinder + func (b *ValueBinder) MustString(sourceParam string, dest *string) *ValueBinder + func (b *ValueBinder) MustStrings(sourceParam string, dest *[]string) *ValueBinder + func (b *ValueBinder) MustTime(sourceParam string, dest *time.Time, layout string) *ValueBinder + func (b *ValueBinder) MustTimes(sourceParam string, dest *[]time.Time, layout string) *ValueBinder + func (b *ValueBinder) MustUint(sourceParam string, dest *uint) *ValueBinder + func (b *ValueBinder) MustUint16(sourceParam string, dest *uint16) *ValueBinder + func (b *ValueBinder) MustUint16s(sourceParam string, dest *[]uint16) *ValueBinder + func (b *ValueBinder) MustUint32(sourceParam string, dest *uint32) *ValueBinder + func (b *ValueBinder) MustUint32s(sourceParam string, dest *[]uint32) *ValueBinder + func (b *ValueBinder) MustUint64(sourceParam string, dest *uint64) *ValueBinder + func (b *ValueBinder) MustUint64s(sourceParam string, dest *[]uint64) *ValueBinder + func (b *ValueBinder) MustUint8(sourceParam string, dest *uint8) *ValueBinder + func (b *ValueBinder) MustUint8s(sourceParam string, dest *[]uint8) *ValueBinder + func (b *ValueBinder) MustUints(sourceParam string, dest *[]uint) *ValueBinder + func (b *ValueBinder) MustUnixTime(sourceParam string, dest *time.Time) *ValueBinder + func (b *ValueBinder) MustUnixTimeNano(sourceParam string, dest *time.Time) *ValueBinder + func (b *ValueBinder) String(sourceParam string, dest *string) *ValueBinder + func (b *ValueBinder) Strings(sourceParam string, dest *[]string) *ValueBinder + func (b *ValueBinder) Time(sourceParam string, dest *time.Time, layout string) *ValueBinder + func (b *ValueBinder) Times(sourceParam string, dest *[]time.Time, layout string) *ValueBinder + func (b *ValueBinder) Uint(sourceParam string, dest *uint) *ValueBinder + func (b *ValueBinder) Uint16(sourceParam string, dest *uint16) *ValueBinder + func (b *ValueBinder) Uint16s(sourceParam string, dest *[]uint16) *ValueBinder + func (b *ValueBinder) Uint32(sourceParam string, dest *uint32) *ValueBinder + func (b *ValueBinder) Uint32s(sourceParam string, dest *[]uint32) *ValueBinder + func (b *ValueBinder) Uint64(sourceParam string, dest *uint64) *ValueBinder + func (b *ValueBinder) Uint64s(sourceParam string, dest *[]uint64) *ValueBinder + func (b *ValueBinder) Uint8(sourceParam string, dest *uint8) *ValueBinder + func (b *ValueBinder) Uint8s(sourceParam string, dest *[]uint8) *ValueBinder + func (b *ValueBinder) Uints(sourceParam string, dest *[]uint) *ValueBinder + func (b *ValueBinder) UnixTime(sourceParam string, dest *time.Time) *ValueBinder + func (b *ValueBinder) UnixTimeNano(sourceParam string, dest *time.Time) *ValueBinder v0.1.1 Jul 9, 2022 v0.1.0 Jul 4, 2022 Changes in this version + const HeaderAccept + const HeaderAcceptEncoding + const HeaderAccessControlAllowCredentials + const HeaderAccessControlAllowHeaders + const HeaderAccessControlAllowMethods + const HeaderAccessControlAllowOrigin + const HeaderAccessControlExposeHeaders + const HeaderAccessControlMaxAge + const HeaderAccessControlRequestHeaders + const HeaderAccessControlRequestMethod + const HeaderAllow + const HeaderAuthorization + const HeaderCacheControl + const HeaderConnection + const HeaderContentDisposition + const HeaderContentEncoding + const HeaderContentLength + const HeaderContentSecurityPolicy + const HeaderContentSecurityPolicyReportOnly + const HeaderContentType + const HeaderCookie + const HeaderIfModifiedSince + const HeaderLastModified + const HeaderLocation + const HeaderOrigin + const HeaderReferrerPolicy + const HeaderRetryAfter + const HeaderServer + const HeaderSetCookie + const HeaderStrictTransportSecurity + const HeaderUpgrade + const HeaderVary + const HeaderWWWAuthenticate + const HeaderXCSRFToken + const HeaderXContentTypeOptions + const HeaderXCorrelationID + const HeaderXForwardedFor + const HeaderXForwardedProto + const HeaderXForwardedProtocol + const HeaderXForwardedSSL + const HeaderXFrameOptions + const HeaderXHTTPMethodOverride + const HeaderXRealIP + const HeaderXRequestID + const HeaderXRequestedWith + const HeaderXURLScheme + const HeaderXXSSProtection + const MIMEApplicationForm + const MIMEApplicationJSON + const MIMEApplicationJSONCharsetUTF8 + const MIMEApplicationJavaScript + const MIMEApplicationJavaScriptCharsetUTF8 + const MIMEApplicationMsgpack + const MIMEApplicationProtobuf + const MIMEApplicationXML + const MIMEApplicationXMLCharsetUTF8 + const MIMEMultipartForm + const MIMEOctetStream + const MIMETextHTML + const MIMETextHTMLCharsetUTF8 + const MIMETextPlain + const MIMETextPlainCharsetUTF8 + const MIMETextXML + const MIMETextXMLCharsetUTF8 + var ErrBadGateway = NewHTTPError(http.StatusBadGateway) + var ErrBadRequest = NewHTTPError(http.StatusBadRequest) + var ErrForbidden = NewHTTPError(http.StatusForbidden) + var ErrInternalServerError = NewHTTPError(http.StatusInternalServerError) + var ErrMethodNotAllowed = NewHTTPError(http.StatusMethodNotAllowed) + var ErrNotFound = NewHTTPError(http.StatusNotFound) + var ErrRequestTimeout = NewHTTPError(http.StatusRequestTimeout) + var ErrServiceUnavailable = NewHTTPError(http.StatusServiceUnavailable) + var ErrStatusRequestEntityTooLarge = NewHTTPError(http.StatusRequestEntityTooLarge) + var ErrTooManyRequests = NewHTTPError(http.StatusTooManyRequests) + var ErrUnauthorized = NewHTTPError(http.StatusUnauthorized) + var ErrUnsupportedMediaType = NewHTTPError(http.StatusUnsupportedMediaType) + var HTTPErrorHandler HTTPErrorHandlerFunc = HandleHTTPError(false) + var Logger logger = log.New(os.Stderr, "httpx: ", log.LstdFlags | log.Lmsgprefix) + var RequestBinder interface + type HTTPError struct + Code int + Err error + Message string + func NewHTTPError(code int, message ...string) *HTTPError + func WrapHTTPError(err error, code int, message ...string) *HTTPError + func (e *HTTPError) Error() string + func (e *HTTPError) Unwrap() error + func (e *HTTPError) WithError(err error) *HTTPError + type HTTPErrorHandlerFunc func(req *Request, res *Responder, err error) + func HandleHTTPError(expose bool) HTTPErrorHandlerFunc + type HandlerFunc func(req *Request, res *Responder) error + func H(handler http.Handler) HandlerFunc + func (h HandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Request struct + func NewRequest(r *http.Request) *Request + func (r *Request) Bind(v any) error + func (r *Request) FormFile(name string) (*multipart.FileHeader, error) + func (r *Request) FormParams() (url.Values, error) + func (r *Request) GetValue(key any) any + func (r *Request) IsTLS() bool + func (r *Request) IsWebSocket() bool + func (r *Request) MultipartForm() (*multipart.Form, error) + func (r *Request) QueryParam(name string) string + func (r *Request) QueryParams() url.Values + func (r *Request) QueryString() string + func (r *Request) Scheme() string + func (r *Request) SetValue(key, val any) + type Responder struct + Committed bool + Size int64 + StatusCode int + Writer http.ResponseWriter + func NewResponder(w http.ResponseWriter) *Responder + func (r *Responder) After(fn func()) + func (r *Responder) Before(fn func()) + func (r *Responder) Blob(contentType string, b []byte) error + func (r *Responder) Flush() + func (r *Responder) HTML(html string) error + func (r *Responder) Header() http.Header + func (r *Responder) Hijack() (net.Conn, *bufio.ReadWriter, error) + func (r *Responder) JSON(i any, indent string) error + func (r *Responder) NoContent() error + func (r *Responder) Redirect(url string) error + func (r *Responder) SetCookie(cookie *http.Cookie) *Responder + func (r *Responder) Status(code int) *Responder + func (r *Responder) Stream(contentType string, reader io.Reader) error + func (r *Responder) String(s string) error + func (r *Responder) Template(tpl *template.Template, name string, data any) error + func (r *Responder) Write(b []byte) (n int, err error) + func (r *Responder) WriteHeader(code int) + func (r *Responder) XML(i any, indent string) error