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

Function writeOAuth2RegistrationError

coderd/oauth2provider/registration.go:516–528  ·  view source on GitHub ↗

writeOAuth2RegistrationError writes RFC 7591 compliant error responses

(_ context.Context, rw http.ResponseWriter, status int, errorCode, description string)

Source from the content-addressed store, hash-verified

514
515// writeOAuth2RegistrationError writes RFC 7591 compliant error responses
516func writeOAuth2RegistrationError(_ context.Context, rw http.ResponseWriter, status int, errorCode, description string) {
517 // RFC 7591 error response format
518 errorResponse := map[string]string{
519 "error": errorCode,
520 }
521 if description != "" {
522 errorResponse["error_description"] = description
523 }
524
525 rw.Header().Set("Content-Type", "application/json")
526 rw.WriteHeader(status)
527 _ = json.NewEncoder(rw).Encode(errorResponse)
528}
529
530// createDisplaySecret creates a display version of the secret showing only the last few characters
531func createDisplaySecret(secret string) string {

Callers 5

GetClientConfigurationFunction · 0.85

Calls 4

EncodeMethod · 0.80
SetMethod · 0.65
HeaderMethod · 0.45
WriteHeaderMethod · 0.45

Tested by

no test coverage detected