Documentation
¶
Index ¶
- func Status(pattern string) responseExampleOption
- type Option
- func CACert(cacert []byte) Option
- func Certificates(cert, key []byte) Option
- func ClientCACert(cacert []byte) Option
- func ClientCertificates(cert, key []byte) Option
- func OpenApi3(l string) Option
- func OpenApi3FromData(b []byte) Option
- func SkipCircularReferenceCheck(skip bool) Option
- func SkipValidateRequest(skip bool) Option
- func SkipValidateResponse(skip bool) Option
- func UseTLS() Option
- func UseTLSWithCertificates(cert, key []byte) Option
- type Router
- func (rt *Router) ClearRequests()
- func (rt *Router) Client() *http.Client
- func (rt *Router) Close()
- func (rt *Router) DefaultHeader(key, value string)
- func (rt *Router) DefaultMiddleware(mw func(next http.HandlerFunc) http.HandlerFunc)
- func (rt *Router) Match(fn func(r *http.Request) bool) *matcher
- func (rt *Router) Method(method string) *matcher
- func (rt *Router) Path(path string) *matcher
- func (rt *Router) Pathf(format string, a ...any) *matcher
- func (rt *Router) Prepend() *Router
- func (rt *Router) Query(key, value string) *matcher
- func (rt *Router) Requests() []*http.Request
- func (rt *Router) ResponseExample(opts ...responseExampleOption)
- func (rt *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (rt *Router) Server() *httptest.Server
- func (rt *Router) TLSServer() *httptest.Server
- type TB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶ added in v0.4.0
type Option func(*config) error
func Certificates ¶ added in v0.4.1
Certificates set certificates ( cert, key )
func ClientCACert ¶ added in v0.5.0
ClientCACert set client CA
func ClientCertificates ¶ added in v0.5.0
ClientCertificates set client certificates ( cert, key )
func OpenApi3FromData ¶ added in v0.8.0
OpenApi3FromData sets OpenAPI Document from bytes
func SkipCircularReferenceCheck ¶ added in v0.17.0
SkipCircularReferenceCheck sets whether to skip circular reference check in OpenAPI Document.
func SkipValidateRequest ¶ added in v0.8.0
SkipValidateRequest sets whether to skip validation of HTTP request with OpenAPI Document.
func SkipValidateResponse ¶ added in v0.8.0
SkipValidateResponse sets whether to skip validation of HTTP response with OpenAPI Document.
func UseTLSWithCertificates ¶ added in v0.4.0
UseTLSWithCertificates enable TLS with certificates ( cert, key )
type Router ¶ added in v0.3.0
type Router struct { // Set *httptest.Server.URL URL string // contains filtered or unexported fields }
func NewTLSServer ¶ added in v0.4.0
NewTLSServer returns a new router including TLS *httptest.Server.
func (*Router) ClearRequests ¶ added in v0.6.0
func (rt *Router) ClearRequests()
ClearRequests clear []*http.Request received by router.
func (*Router) Client ¶ added in v0.3.0
Client returns *http.Client which requests *httptest.Server.
func (*Router) DefaultHeader ¶ added in v0.3.0
DefaultHeader append default middleware which append header.
func (*Router) DefaultMiddleware ¶ added in v0.3.0
func (rt *Router) DefaultMiddleware(mw func(next http.HandlerFunc) http.HandlerFunc)
DefaultMiddleware append default middleware.
func (*Router) Match ¶ added in v0.3.0
Match create request matcher with matchFunc (func(r *http.Request) bool).
func (*Router) ResponseExample ¶ added in v0.9.0
func (rt *Router) ResponseExample(opts ...responseExampleOption)
ResponseExample set handler which return response using examples of OpenAPI v3 Document
func (*Router) ServeHTTP ¶ added in v0.3.0
func (rt *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)