httpx

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Code generated by genx:enum DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var (
	OperationMetaFrom  = types.OperationMetaFrom
	WithOperationMeta  = types.WithOperationMeta
	MustOperationMeta  = types.MustOperationMeta
	CarryOperationMeta = types.CarryOperationMeta

	RequestFrom  = types.RequestFrom
	WithRequest  = types.WithRequest
	MustRequest  = types.MustRequest
	CarryRequest = types.CarryRequest

	OperationMetaProviderFrom  = types.OperationMetaProviderFrom
	WithOperationMetaProvider  = types.WithOperationMetaProvider
	MustOperationMetaProvider  = types.MustOperationMetaProvider
	CarryOperationMetaProvider = types.CarryOperationMetaProvider
)
View Source
var (
	ServersFrom  = contextx.From[tCtxServers, []string]
	WithServers  = contextx.With[tCtxServers, []string]
	MustServers  = contextx.Must[tCtxServers, []string]
	CarryServers = contextx.Carry[tCtxServers, []string]
)
View Source
var (
	MergeMetadata = metadata.Merge
)

Functions

func ClientIPByHeaderForwardedFor

func ClientIPByHeaderForwardedFor(v string) string

ClientIPByHeaderForwardedFor returns client ip X-Forwarded-For: client, proxy1, ..., proxyN

func ClientIPByHeaderRealIP

func ClientIPByHeaderRealIP(v string) string

ClientIPByHeaderRealIP returns client ip X-Real-IP: 203.0.113.195, 2001:db8:85a3:8d3:1319:8a2e:370:7348

func IsStatusOK

func IsStatusOK[Code ~int](v Code) bool

func Run

func Run(router Router, transports ...Transport)

Types

type Client

type Client = client.Client

type Content

type Content = content.Content

type ContentLengthDescriber

type ContentLengthDescriber = content.LengthDescriber

type ContentMediaTypeDescriber

type ContentMediaTypeDescriber = content.MediaTypeDescriber

type ContentProvider

type ContentProvider = content.Provider

type ContentReader

type ContentReader = content.Reader

type Handler

type Handler = route.Handler

type HttpTransport

type HttpTransport = func(rt http.RoundTripper) http.RoundTripper

type IncomingTransport

type IncomingTransport = transport.Incoming

type Metadata

type Metadata = metadata.Metadata

type MetadataCarrier

type MetadataCarrier = metadata.Carrier

type MethodConnect

type MethodConnect struct{}

func (MethodConnect) Method

func (MethodConnect) Method() string

type MethodDelete

type MethodDelete struct{}

func (MethodDelete) Method

func (MethodDelete) Method() string

type MethodDescriptor

type MethodDescriptor = method.Describer

type MethodGet

type MethodGet struct{}

func (MethodGet) Method

func (MethodGet) Method() string

type MethodHead

type MethodHead struct{}

func (MethodHead) Method

func (MethodHead) Method() string

type MethodOptions

type MethodOptions struct{}

func (MethodOptions) Method

func (MethodOptions) Method() string

type MethodPatch

type MethodPatch struct{}

func (MethodPatch) Method

func (MethodPatch) Method() string

type MethodPost

type MethodPost struct{}

func (MethodPost) Method

func (MethodPost) Method() string

type MethodPut

type MethodPut struct{}

func (MethodPut) Method

func (MethodPut) Method() string

type MethodTrace

type MethodTrace struct{}

func (MethodTrace) Method

func (MethodTrace) Method() string

type Middleware

type Middleware = route.Middleware

func ApplyMiddlewares

func ApplyMiddlewares(middlewares ...Middleware) Middleware

type Operator

type Operator = operator.Operator

type OutgoingTransport

type OutgoingTransport = transport.Outgoing

type Request

type Request = request.Request

type Response

type Response[T any] = response.Response[T]

func ErrorResponse

func ErrorResponse(err error, appliers ...ResponseApplier) Response[error]

func WrapResponse

func WrapResponse[T any](v T, appliers ...ResponseApplier) Response[T]

type ResponseApplier

type ResponseApplier = response.Applier

func WithContentLength

func WithContentLength(n int64) ResponseApplier

func WithContentType

func WithContentType(t string) ResponseApplier

func WithCookies

func WithCookies(cookies ...*http.Cookie) ResponseApplier

func WithMetadata

func WithMetadata(key string, values ...string) ResponseApplier

func WithStatusCode

func WithStatusCode[Code ~int](code Code) ResponseApplier

type Result

type Result = client.Result

type RoundTrip

type RoundTrip func(r *http.Request) (*http.Response, error)

type Route

type Route = route.Route

type Router

type Router = route.Router

func BasePathRouter

func BasePathRouter(path string) Router

func GroupRouter

func GroupRouter(group string) Router

func NewRouter

func NewRouter(operators ...Operator) Router

type Routes

type Routes = route.Routes

type Status

type Status int

Status presents http status code. imported from net/http/status.go HTTP status codes as registered with IANA. See: https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml +genx:enum

const (
	STATUS_UNKNOWN Status = 0

	STATUS__CONTINUE            Status = http.StatusContinue           // RFC 9110, 15.2.1
	STATUS__SWITCHING_PROTOCOLS Status = http.StatusSwitchingProtocols // RFC 9110, 15.2.2
	STATUS__PROCESSING          Status = http.StatusProcessing         // RFC 2518, 10.1
	STATUS__EARLY_HINTS         Status = http.StatusEarlyHints         // RFC 8297

	STATUS__OK                     Status = http.StatusOK                   // RFC 9110, 15.3.1
	STATUS__CREATED                Status = http.StatusCreated              // RFC 9110, 15.3.2
	STATUS__ACCEPTED               Status = http.StatusAccepted             // RFC 9110, 15.3.3
	STATUS__NON_AUTHORITATIVE_INFO Status = http.StatusNonAuthoritativeInfo // RFC 9110, 15.3.4
	STATUS__NO_CONTENT             Status = http.StatusNoContent            // RFC 9110, 15.3.5
	STATUS__RESET_CONTENT          Status = http.StatusResetContent         // RFC 9110, 15.3.6
	STATUS__PARTIAL_CONTENT        Status = http.StatusPartialContent       // RFC 9110, 15.3.7
	STATUS__MULTI_STATUS           Status = http.StatusMultiStatus          // RFC 4918, 11.1
	STATUS__ALREADY_REPORTED       Status = http.StatusAlreadyReported      // RFC 5842, 7.1
	STATUS__IM_USED                Status = http.StatusIMUsed               // RFC 3229, 10.4.1

	STATUS__MULTIPLE_CHOICES  Status = http.StatusMultipleChoices  // RFC 9110, 15.4.1
	STATUS__MOVED_PERMANENTLY Status = http.StatusMovedPermanently // RFC 9110, 15.4.2
	STATUS__FOUND             Status = http.StatusFound            // RFC 9110, 15.4.3
	STATUS__SEE_OTHER         Status = http.StatusSeeOther         // RFC 9110, 15.4.4
	STATUS__NOT_MODIFIED      Status = http.StatusNotModified      // RFC 9110, 15.4.5
	STATUS__USE_PROXY         Status = http.StatusUseProxy         // RFC 9110, 15.4.6

	STATUS__TEMPORARY_REDIRECT Status = http.StatusTemporaryRedirect // RFC 9110, 15.4.8
	STATUS__PERMANENT_REDIRECT Status = http.StatusPermanentRedirect // RFC 9110, 15.4.9

	STATUS__BAD_REQUEST                     Status = http.StatusBadRequest                   // RFC 9110, 15.5.1
	STATUS__UNAUTHORIZED                    Status = http.StatusUnauthorized                 // RFC 9110, 15.5.2
	STATUS__PAYMENT_REQUIRED                Status = http.StatusPaymentRequired              // RFC 9110, 15.5.3
	STATUS__FORBIDDEN                       Status = http.StatusForbidden                    // RFC 9110, 15.5.4
	STATUS__NOTFOUND                        Status = http.StatusNotFound                     // RFC 9110, 15.5.5
	STATUS__METHOD_NOT_ALLOWED              Status = http.StatusMethodNotAllowed             // RFC 9110, 15.5.6
	STATUS__NOT_ACCEPTABLE                  Status = http.StatusNotAcceptable                // RFC 9110, 15.5.7
	STATUS__PROXY_AUTH_REQUIRED             Status = http.StatusProxyAuthRequired            // RFC 9110, 15.5.8
	STATUS__REQUEST_TIMEOUT                 Status = http.StatusRequestTimeout               // RFC 9110, 15.5.9
	STATUS__CONFLICT                        Status = http.StatusConflict                     // RFC 9110, 15.5.10
	STATUS__GONE                            Status = http.StatusGone                         // RFC 9110, 15.5.11
	STATUS__LENGTH_REQUIRED                 Status = http.StatusLengthRequired               // RFC 9110, 15.5.12
	STATUS__PRECONDITION_FAILED             Status = http.StatusPreconditionFailed           // RFC 9110, 15.5.13
	STATUS__REQUEST_ENTITY_TOO_LARGE        Status = http.StatusRequestEntityTooLarge        // RFC 9110, 15.5.14
	STATUS__REQUEST_URI_TOO_LONG            Status = http.StatusRequestURITooLong            // RFC 9110, 15.5.15
	STATUS__UNSUPPORTED_MEDIA_TYPE          Status = http.StatusUnsupportedMediaType         // RFC 9110, 15.5.16
	STATUS__REQUESTED_RANGE_NOT_SATISFIABLE Status = http.StatusRequestedRangeNotSatisfiable // RFC 9110, 15.5.17
	STATUS__EXPECTATION_FAILED              Status = http.StatusExpectationFailed            // RFC 9110, 15.5.18
	STATUS__TEAPOT                          Status = http.StatusTeapot                       // RFC 9110, 15.5.19 (Unused)
	STATUS__MISDIRECTED_REQUEST             Status = http.StatusMisdirectedRequest           // RFC 9110, 15.5.20
	STATUS__UNPROCESSABLE_ENTITY            Status = http.StatusUnprocessableEntity          // RFC 9110, 15.5.21
	STATUS__LOCKED                          Status = http.StatusLocked                       // RFC 4918, 11.3
	STATUS__FAILED_DEPENDENCY               Status = http.StatusFailedDependency             // RFC 4918, 11.4
	STATUS__TOO_EARLY                       Status = http.StatusTooEarly                     // RFC 8470, 5.2.
	STATUS__UPGRADE_REQUIRED                Status = http.StatusUpgradeRequired              // RFC 9110, 15.5.22
	STATUS__PRECONDITION_REQUIRED           Status = http.StatusPreconditionRequired         // RFC 6585, 3
	STATUS__TOO_MANY_REQUESTS               Status = http.StatusTooManyRequests              // RFC 6585, 4
	STATUS__REQUEST_HEADER_FIELDS_TOO_LARGE Status = http.StatusRequestHeaderFieldsTooLarge  // RFC 6585, 5
	STATUS__UNAVAILABLE_FOR_LEGAL_REASONS   Status = http.StatusUnavailableForLegalReasons   // RFC 7725, 3

	STATUS__INTERNAL_SERVER_ERROR           Status = http.StatusInternalServerError           // RFC 9110, 15.6.1
	STATUS__NOT_IMPLEMENTED                 Status = http.StatusNotImplemented                // RFC 9110, 15.6.2
	STATUS__BAD_GATEWAY                     Status = http.StatusBadGateway                    // RFC 9110, 15.6.3
	STATUS__SERVICE_UNAVAILABLE             Status = http.StatusServiceUnavailable            // RFC 9110, 15.6.4
	STATUS__GATEWAY_TIMEOUT                 Status = http.StatusGatewayTimeout                // RFC 9110, 15.6.5
	STATUS__HTTP_VERSION_NOT_SUPPORTED      Status = http.StatusHTTPVersionNotSupported       // RFC 9110, 15.6.6
	STATUS__VARIANT_ALSO_NEGOTIATES         Status = http.StatusVariantAlsoNegotiates         // RFC 2295, 8.1
	STATUS__INSUFFICIENT_STORAGE            Status = http.StatusInsufficientStorage           // RFC 4918, 11.5
	STATUS__LOOP_DETECTED                   Status = http.StatusLoopDetected                  // RFC 5842, 7.2
	STATUS__NOT_EXTENDED                    Status = http.StatusNotExtended                   // RFC 2774, 7
	STATUS__NETWORK_AUTHENTICATION_REQUIRED Status = http.StatusNetworkAuthenticationRequired // RFC 6585, 6

	STATUS__NO_RESPONSE                     Status = 444
	STATUS__REQUEST_HEADER_TOO_LARGE        Status = 494
	STATUS__SSL_CERTIFICATE_ERROR           Status = 495
	STATUS__SSL_CERTIFICATE_REQUIRED        Status = 496
	STATUS__HTTP_REQUEST_SENT_TO_HTTPS_PORT Status = 497
	STATUS__CLIENT_CLOSED_REQUEST           Status = 499
)

func ParseStatus

func ParseStatus(key string) (Status, error)

ParseStatus parse Status from key

func (Status) IsValid

func (s Status) IsValid() bool

func (Status) IsZero

func (v Status) IsZero() bool

IsZero checks if v is zero

func (Status) MarshalText

func (v Status) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler

func (*Status) Scan

func (v *Status) Scan(src any) error

Scan implements sql.Scanner

func (Status) StatusCode

func (s Status) StatusCode() int

func (Status) StatusText

func (s Status) StatusText() string

func (Status) String

func (v Status) String() string

String returns v's string as key

func (Status) Text

func (v Status) Text() string

Text returns the description as for human reading

func (*Status) UnmarshalText

func (v *Status) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler

func (Status) Value

func (v Status) Value() (driver.Value, error)

Value implements driver.Valuer

func (Status) Values

func (Status) Values() []Status

Values returns enum value list of Status

func (Status) Wrap

func (s Status) Wrap(err error) error

type StatusDescriber

type StatusDescriber = status.Describer

type StatusError

type StatusError = status.Error

type Transformer

type Transformer = transformer.Transformer

type TransformerProvider

type TransformerProvider = transformer.Provider

type Transport

type Transport interface {
	Serve(Router) error
}

type Upgrader

type Upgrader = transport.Upgrader

Jump to

Keyboard shortcuts

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