Documentation
¶
Index ¶
- Variables
- type HttpRoundTrip
- func (self *HttpRoundTrip) Accept() []byte
- func (self *HttpRoundTrip) Close()
- func (self *HttpRoundTrip) ContentType() []byte
- func (self *HttpRoundTrip) MatchedPath() string
- func (self *HttpRoundTrip) Method() []byte
- func (self *HttpRoundTrip) Path() []byte
- func (self *HttpRoundTrip) PathParam(param string) (string, bool)
- func (self *HttpRoundTrip) PeekRequestHeader(key string) []byte
- func (self *HttpRoundTrip) PeekResponseHeader(header string) []byte
- func (self *HttpRoundTrip) QueryParam(param string) (string, bool)
- func (self *HttpRoundTrip) RequestBody() []byte
- func (self *HttpRoundTrip) RequestId() string
- func (self *HttpRoundTrip) ResponseBody() []byte
- func (self *HttpRoundTrip) ResponseContentType() []byte
- func (self *HttpRoundTrip) SetResponseBody(body []byte)
- func (self *HttpRoundTrip) SetResponseContentType(contentType string)
- func (self *HttpRoundTrip) SetResponseHeader(header string, value string)
- func (self *HttpRoundTrip) SetStatusCode(statusCode int)
- func (self *HttpRoundTrip) StatusCode() int
- func (self *HttpRoundTrip) VisitRequestHeaders(f func(key []byte, value []byte))
- func (self *HttpRoundTrip) VisitResponseHeaders(f func(header []byte, value []byte))
- func (self *HttpRoundTrip) WriteResponse()
- type Request
- type Response
- type RoundTripper
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidBody = errors.New("invalid body")
)
Functions ¶
This section is empty.
Types ¶
type HttpRoundTrip ¶
type HttpRoundTrip struct {
// contains filtered or unexported fields
}
func NewHttpRoundTrip ¶
func NewHttpRoundTrip(matchedPath string, request *http.Request) (*HttpRoundTrip, error)
func (*HttpRoundTrip) Accept ¶
func (self *HttpRoundTrip) Accept() []byte
func (*HttpRoundTrip) Close ¶
func (self *HttpRoundTrip) Close()
func (*HttpRoundTrip) ContentType ¶
func (self *HttpRoundTrip) ContentType() []byte
func (*HttpRoundTrip) MatchedPath ¶
func (self *HttpRoundTrip) MatchedPath() string
func (*HttpRoundTrip) Method ¶
func (self *HttpRoundTrip) Method() []byte
func (*HttpRoundTrip) Path ¶
func (self *HttpRoundTrip) Path() []byte
func (*HttpRoundTrip) PeekRequestHeader ¶
func (self *HttpRoundTrip) PeekRequestHeader(key string) []byte
func (*HttpRoundTrip) PeekResponseHeader ¶
func (self *HttpRoundTrip) PeekResponseHeader(header string) []byte
func (*HttpRoundTrip) QueryParam ¶
func (self *HttpRoundTrip) QueryParam(param string) (string, bool)
func (*HttpRoundTrip) RequestBody ¶
func (self *HttpRoundTrip) RequestBody() []byte
func (*HttpRoundTrip) RequestId ¶
func (self *HttpRoundTrip) RequestId() string
func (*HttpRoundTrip) ResponseBody ¶
func (self *HttpRoundTrip) ResponseBody() []byte
func (*HttpRoundTrip) ResponseContentType ¶
func (self *HttpRoundTrip) ResponseContentType() []byte
func (*HttpRoundTrip) SetResponseBody ¶
func (self *HttpRoundTrip) SetResponseBody(body []byte)
func (*HttpRoundTrip) SetResponseContentType ¶
func (self *HttpRoundTrip) SetResponseContentType(contentType string)
func (*HttpRoundTrip) SetResponseHeader ¶
func (self *HttpRoundTrip) SetResponseHeader(header string, value string)
func (*HttpRoundTrip) SetStatusCode ¶
func (self *HttpRoundTrip) SetStatusCode(statusCode int)
func (*HttpRoundTrip) StatusCode ¶
func (self *HttpRoundTrip) StatusCode() int
func (*HttpRoundTrip) VisitRequestHeaders ¶
func (self *HttpRoundTrip) VisitRequestHeaders(f func(key []byte, value []byte))
func (*HttpRoundTrip) VisitResponseHeaders ¶
func (self *HttpRoundTrip) VisitResponseHeaders(f func(header []byte, value []byte))
func (*HttpRoundTrip) WriteResponse ¶
func (self *HttpRoundTrip) WriteResponse()
type Request ¶
type Request interface {
// RequestId unique to the request.
// Usually used for tracing and debugging.
RequestId() string
// Method, ie HTTP Method.
Method() []byte
// Path of the incoming request.
Path() []byte
// ContentType header of the request.
ContentType() []byte
// Accept header of the request.
Accept() []byte
PeekRequestHeader(header string) []byte
VisitRequestHeaders(f func(header []byte, value []byte))
// MatchedPath returns the routing path that the incoming request path matched.
// Ex: /some/path/{id}
MatchedPath() string
// PathParam returns the path parameter value for the given parameter name.
// Returns false if parameter not found.
PathParam(param string) (string, bool)
// QueryParam returns the query parameter value for the given parameter name.
// Returns false if parameter not found.
QueryParam(param string) (string, bool)
// RequestBody returns the read body.
// This function should be able to be called multiple times.
RequestBody() []byte
}
type Response ¶
type Response interface {
SetStatusCode(statusCode int)
SetResponseBody(responseBody []byte)
SetResponseHeader(header string, value string)
SetResponseContentType(contentType string)
StatusCode() int
ResponseContentType() []byte
PeekResponseHeader(header string) []byte
VisitResponseHeaders(f func(header []byte, value []byte))
ResponseBody() []byte
WriteResponse()
}
type RoundTripper ¶
Click to show internal directories.
Click to hide internal directories.