MCPcopy Index your code
hub / github.com/coder/coder / APIKeyOptional

Function APIKeyOptional

coderd/httpmw/apikey.go:86–89  ·  view source on GitHub ↗

APIKeyOptional may return an API key from the ExtractAPIKey handler.

(r *http.Request)

Source from the content-addressed store, hash-verified

84
85// APIKeyOptional may return an API key from the ExtractAPIKey handler.
86func APIKeyOptional(r *http.Request) (database.APIKey, bool) {
87 key, ok := r.Context().Value(apiKeyContextKey{}).(database.APIKey)
88 return key, ok
89}
90
91// APIKey returns the API key from the ExtractAPIKey handler.
92func APIKey(r *http.Request) database.APIKey {

Callers 9

TestAPIKeyFunction · 0.92
InitRequestFunction · 0.92
authorizeMethod · 0.92
ExtractUserContextFunction · 0.85
APIKeyFunction · 0.85

Calls 2

ContextMethod · 0.65
ValueMethod · 0.45

Tested by 1

TestAPIKeyFunction · 0.74