Documentation
¶
Index ¶
- Constants
- func AppendScope(r *http.Request, scope string)
- func FeaturesHandler(c client.IFace) func(w http.ResponseWriter, r *http.Request)
- func GetScopes(r *http.Request) []string
- func ScopeMapFromRequest(c client.IFace, r *http.Request) *models.FeatureMap
- func SetResponseHeaders(w http.ResponseWriter, r *http.Request)
- func SetScopes(r *http.Request, scopes []string)
Constants ¶
View Source
const ( // DcdrScopesHeader comma delimited scopes to pass to the client DcdrScopesHeader = "x-dcdr-scopes" // ContentTypeHeader header for content type ContentTypeHeader = "Content-Type" // ContentType set JSON content type for responses ContentType = "application/json" // MaxScopeLimit the maximum amount of scopes allowed MaxScopeLimit = 8 )
Variables ¶
This section is empty.
Functions ¶
func AppendScope ¶ added in v0.3.0
AppendScope adds a scope to the `x-dcdr-scopes` header
func FeaturesHandler ¶
FeaturesHandler default handler for serving a FeatureMap via HTTP
func GetScopes ¶
GetScopes parses the comma delimited string from DcdrScopesHeader into a slice of strings.
x-dcdr-scopes: "a/b/c, d" => []string{"a/b/c", "d"}
func ScopeMapFromRequest ¶
ScopeMapFromRequest helper method for returning a FeatureMap scoped to the values found in DcdrScopesHeader.
func SetResponseHeaders ¶
func SetResponseHeaders(w http.ResponseWriter, r *http.Request)
SetResponseHeaders set the common response headers
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.