Documentation ¶
Index ¶
- Constants
- func Bind(req *http.Request, target interface{}) error
- func BindForm(req *http.Request, target interface{}) error
- func BindQuery(req *http.Request, target interface{}) error
- func CodecForRequest(r *http.Request, name string) (encoding.Codec, bool)
- func DefaultResponseEncoder(w http.ResponseWriter, r *http.Request, v interface{}) error
- func EncodeResponse(w http.ResponseWriter, r *http.Request, v interface{}) error
- func ExcelResponse(fileName string) func(context.Context, http.ResponseWriter, interface{}) error
- func HttpClientFilter(mid []endpoint.Middleware) func(context.Context, *http.Request) context.Context
- func HttpServerFilter() mux.MiddlewareFunc
- func JSONResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error)
- func JSONiterResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error)
- func ReturnResponse(code int, contentType string) func(context.Context, http.ResponseWriter, interface{}) error
- func SetOperation(ctx context.Context, op string)
- func StringResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error)
- func ToheaderCarrier(h http.Header) headerCarrier
- func XMLResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error)
- type DecodeRequestFunc
- type EncodeErrorFunc
- type EncodeResponseFunc
- type Transport
- func (tr *Transport) Endpoint() string
- func (tr *Transport) Kind() xtransport.Kind
- func (tr *Transport) Operation() string
- func (tr *Transport) PathTemplate() string
- func (tr *Transport) ReplyHeader() xtransport.Header
- func (tr *Transport) Request() *http.Request
- func (tr *Transport) RequestHeader() xtransport.Header
- type Transporter
Constants ¶
View Source
const SupportPackageIsVersion1 = true
SupportPackageIsVersion1 These constants should not be referenced from any other code.
Variables ¶
This section is empty.
Functions ¶
func CodecForRequest ¶
CodecForRequest get encoding.Codec via http.Request
func DefaultResponseEncoder ¶
func DefaultResponseEncoder(w http.ResponseWriter, r *http.Request, v interface{}) error
DefaultResponseEncoder encodes the object to the HTTP response.
func EncodeResponse ¶
func EncodeResponse(w http.ResponseWriter, r *http.Request, v interface{}) error
func ExcelResponse ¶
func HttpClientFilter ¶
func HttpServerFilter ¶
func HttpServerFilter() mux.MiddlewareFunc
func JSONResponse ¶
func JSONResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error)
func JSONiterResponse ¶
func JSONiterResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error)
func ReturnResponse ¶
func SetOperation ¶
SetOperation sets the transport operation.
func StringResponse ¶
func StringResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error)
func ToheaderCarrier ¶
func XMLResponse ¶
func XMLResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error)
Types ¶
type DecodeRequestFunc ¶
DecodeRequestFunc is decode request func.
type EncodeErrorFunc ¶
type EncodeErrorFunc func(http.ResponseWriter, *http.Request, error)
EncodeErrorFunc is encode error func.
type EncodeResponseFunc ¶
type EncodeResponseFunc func(http.ResponseWriter, *http.Request, interface{}) error
EncodeResponseFunc is encode response func.
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport is an HTTP transport.
func NewTransport ¶
func (*Transport) Kind ¶
func (tr *Transport) Kind() xtransport.Kind
Kind returns the transport kind.
func (*Transport) PathTemplate ¶
PathTemplate returns the http path template.
func (*Transport) ReplyHeader ¶
func (tr *Transport) ReplyHeader() xtransport.Header
ReplyHeader returns the reply header.
func (*Transport) RequestHeader ¶
func (tr *Transport) RequestHeader() xtransport.Header
RequestHeader returns the request header.
type Transporter ¶
type Transporter interface { xtransport.Transporter Request() *http.Request PathTemplate() string }
Transporter is http Transporter
Click to show internal directories.
Click to hide internal directories.