http

package
v0.0.0-...-01d4da0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MulanPSL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const PayloadKey = "payload"

Variables

This section is empty.

Functions

func CodecForRequest

func CodecForRequest(r *http.Request, name string) (encoding.Codec, bool)

func DefaultErrorEncoder

func DefaultErrorEncoder(w http.ResponseWriter, r *http.Request, err error)

func DefaultRequestDecoder

func DefaultRequestDecoder(r *http.Request, v any) error

func DefaultResponseEncoder

func DefaultResponseEncoder(w http.ResponseWriter, r *http.Request, v any) error

func RequestFromServerContext

func RequestFromServerContext(ctx context.Context) (*http.Request, bool)

func SetOperation

func SetOperation(ctx context.Context, op string)

Types

type Context

type Context interface {
	context.Context
	Reset(*gin.Context)
	Vars() url.Values
	Query() url.Values
	Form() url.Values
	Header() http.Header
	Request() *http.Request
	Response() http.ResponseWriter
	Middleware(middleware.Handler) middleware.Handler
	Bind(any) error
}

type ContextWrapper

type ContextWrapper interface {
	FromGinContext(*gin.Context) Context
}

type DecodeRequestFunc

type DecodeRequestFunc func(*http.Request, any) error

type EncodeErrorFunc

type EncodeErrorFunc func(http.ResponseWriter, *http.Request, error)

type EncodeResponseFunc

type EncodeResponseFunc func(http.ResponseWriter, *http.Request, interface{}) error

EncodeResponseFunc is encode response func.

type Flusher

type Flusher = http.Flusher

type GinAdapter

type GinAdapter interface {
	GinHandler() gin.HandlerFunc
	FromGinContext(*gin.Context) Context
	Payload(c *gin.Context, out any)
}

type Redirector

type Redirector interface {
	Redirect() (string, int)
}

type Request

type Request = http.Request

type ResponseWriter

type ResponseWriter = http.ResponseWriter

type Router

type Router struct {
	// contains filtered or unexported fields
}

type Server

type Server struct {
	*http.Server
	// contains filtered or unexported fields
}

func NewServer

func NewServer(opts ...ServerOption) *Server

func (*Server) FromGinContext

func (s *Server) FromGinContext(g *gin.Context) Context

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

type ServerOption

type ServerOption func(*Server)

func Address

func Address(addr string) ServerOption

Address with server address.

func EngineFitment

func EngineFitment(f func(engine *gin.Engine, ada GinAdapter)) ServerOption

func Listener

func Listener(lis net.Listener) ServerOption

func Middleware

func Middleware(m ...middleware.Middleware) ServerOption

func Network

func Network(network string) ServerOption

Network with server network.

func Timeout

func Timeout(timeout time.Duration) ServerOption

type Transport

type Transport struct {
	// contains filtered or unexported fields
}

func (*Transport) Endpoint

func (tr *Transport) Endpoint() string

func (*Transport) Kind

func (tr *Transport) Kind() transport.Kind

func (*Transport) Operation

func (tr *Transport) Operation() string

func (*Transport) PathTemplate

func (tr *Transport) PathTemplate() string

func (*Transport) ReplyHeader

func (tr *Transport) ReplyHeader() transport.Header

func (*Transport) Request

func (tr *Transport) Request() *http.Request

func (*Transport) RequestHeader

func (tr *Transport) RequestHeader() transport.Header

type Transporter

type Transporter interface {
	transport.Transporter
	Request() *http.Request
	PathTemplate() string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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