Documentation ¶
Overview ¶
Package router defines some interfaces for router adapters
Index ¶
Constants ¶
View Source
const ( HeaderCompleteResponseValue = "true" HeaderIncompleteResponseValue = "false" )
Variables ¶
View Source
var ( // CompleteResponseHeaderName is the header to flag incomplete responses to the client CompleteResponseHeaderName = "X-KrakenD-Completed" // HeadersToSend are the headers to pass from the router request to the proxy HeadersToSend = []string{"Content-Type"} // UserAgentHeaderValue is the value of the User-Agent header to add to the proxy request UserAgentHeaderValue = []string{core.KrakendUserAgent} // ErrInternalError is the error returned by the router when something went wrong ErrInternalError = errors.New("internal server error") )
Functions ¶
func DefaultToHTTPError ¶
DefaultToHTTPError is a ToHTTPError transalator that always returns an internal server error
func InitHTTPDefaultTransport ¶
func InitHTTPDefaultTransport(cfg config.ServiceConfig)
InitHTTPDefaultTransport ensures the default HTTP transport is configured just once per execution
Types ¶
type Router ¶
type Router interface {
Run(config.ServiceConfig)
}
Router sets up the public layer exposed to the users
type RouterFunc ¶
type RouterFunc func(config.ServiceConfig)
RouterFunc type is an adapter to allow the use of ordinary functions as routers. If f is a function with the appropriate signature, RouterFunc(f) is a Router that calls f.
func (RouterFunc) Run ¶
func (f RouterFunc) Run(cfg config.ServiceConfig)
Run implements the Router interface
type ToHTTPError ¶
ToHTTPError translates an error into a HTTP status code
Directories ¶
Path | Synopsis |
---|---|
Package gin provides some basic implementations for building routers based on gin-gonic/gin
|
Package gin provides some basic implementations for building routers based on gin-gonic/gin |
Package mux provides some basic implementations for building routers based on net/http mux Package mux provides some basic implementations for building routers based on net/http mux
|
Package mux provides some basic implementations for building routers based on net/http mux Package mux provides some basic implementations for building routers based on net/http mux |
Click to show internal directories.
Click to hide internal directories.