Documentation
¶
Index ¶
- Constants
- func CORSProxyHandler(w http.ResponseWriter, r *http.Request)
- func CouchDbProxyHandler(w http.ResponseWriter, r *http.Request)
- func CreateCouchDBReverseProxy(cfg *config.AppConfig)
- func CreateOAuth2Handler(ctx context.Context) (func(next http.HandlerFunc) http.HandlerFunc, error)
- func CreateRouter(ctx context.Context) (http.Handler, error)
- func HealthHandler(w http.ResponseWriter, r *http.Request)
- func IndexHandler(w http.ResponseWriter, r *http.Request)
- func MethodNotAllowedHandler(w http.ResponseWriter, r *http.Request)
- func NotFoundHandler(w http.ResponseWriter, r *http.Request)
- func SelfServiceSeedHandler(w http.ResponseWriter, r *http.Request)
- func SendJSON(w http.ResponseWriter, status int, payload interface{}) error
- type AuthErrorResponse
Constants ¶
const CouchDBProxyHiddenPathStatus = http.StatusTeapot
CouchDBProxyHiddenPathStatus is the http status that gets delivered to users in case the underlying endpoint should not be reachable via reverse proxy
const PathCORSProxy = "/service/cors-proxy"
PathCORSProxy is the prefix for CORS proxy requests
const PathCouchDbService = "/service/couchdb"
PathCouchDbService is the prefix for couchdb proxy requests
const StatusInvalidContentType = "ORIGIN_RESPONSE_CONTENT_TYPE_UNSUPPORTED"
StatusInvalidContentType indicates that the response content type is not supported by funnel
const StatusInvalidURL = "INVALID_URL"
StatusInvalidURL indicates that the requested url is not valid and can not be requested
const StatusReadFailed = "ORIGIN_RESPONSE_READ_FAILED"
StatusReadFailed indicates during reading from the origin a problem occurred
const StatusRequestFailed = "ORIGIN_REQUEST_FAILED"
StatusRequestFailed indicates the request to the origin has failed
Variables ¶
This section is empty.
Functions ¶
func CORSProxyHandler ¶
func CORSProxyHandler(w http.ResponseWriter, r *http.Request)
CORSProxyHandler contains functionality to route GET request to other origins
func CouchDbProxyHandler ¶
func CouchDbProxyHandler(w http.ResponseWriter, r *http.Request)
CouchDbProxyHandler is the proxy for couchdb
func CreateCouchDBReverseProxy ¶
CreateCouchDBReverseProxy must be called after configuration has been loaded and before executing requests against the couchdb services endpoint(s)
func CreateOAuth2Handler ¶
func CreateOAuth2Handler(ctx context.Context) (func(next http.HandlerFunc) http.HandlerFunc, error)
CreateOAuth2Handler in given context, creates an oauth2 verifier, and returns a middleware
func CreateRouter ¶
CreateRouter returns a ready to use router
func HealthHandler ¶
func HealthHandler(w http.ResponseWriter, r *http.Request)
HealthHandler reports the health status for the entire application or a specific component
func IndexHandler ¶
func IndexHandler(w http.ResponseWriter, r *http.Request)
IndexHandler is the default response a curious user will see
func MethodNotAllowedHandler ¶
func MethodNotAllowedHandler(w http.ResponseWriter, r *http.Request)
MethodNotAllowedHandler sets the HTTP status and finishes
func NotFoundHandler ¶
func NotFoundHandler(w http.ResponseWriter, r *http.Request)
NotFoundHandler sets the HTTP status and finishes
func SelfServiceSeedHandler ¶
func SelfServiceSeedHandler(w http.ResponseWriter, r *http.Request)
SelfServiceSeedHandler creates initial couchdb resources if not already present
func SendJSON ¶
func SendJSON(w http.ResponseWriter, status int, payload interface{}) error
SendJSON response for the given response writer, if an error occurs and 500 is returned to the client and the error is given back if further error handling is required. The cause for the error is also logged.
Types ¶
type AuthErrorResponse ¶
type AuthErrorResponse struct {
Message string `json:"message"`
}
AuthErrorResponse is the representation of an oauth error