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

Function showError

scripts/oauth2/oauth2-test-server.go:210–236  ·  view source on GitHub ↗
(w http.ResponseWriter, message string)

Source from the content-addressed store, hash-verified

208}
209
210func showError(w http.ResponseWriter, message string) {
211 log.Printf("ERROR: %s", message)
212 html := fmt.Sprintf(`
213<!DOCTYPE html>
214<html>
215<head>
216 <title>OAuth2 Test - Error</title>
217 <style>
218 body { font-family: Arial, sans-serif; max-width: 800px; margin: 50px auto; padding: 20px; }
219 .status { padding: 20px; margin: 20px 0; border-radius: 5px; }
220 .error { background: #f8d7da; color: #721c24; }
221 pre { background: #f5f5f5; padding: 15px; overflow-x: auto; }
222 </style>
223</head>
224<body>
225 <h1>OAuth2 Test Server - Error</h1>
226 <div class="status error">
227 <h2>❌ Error</h2>
228 <p>%s</p>
229 </div>
230 <p>Check the server logs for more details.</p>
231</body>
232</html>`, message)
233 w.Header().Set("Content-Type", "text/html")
234 w.WriteHeader(http.StatusBadRequest)
235 _, _ = fmt.Fprint(w, html)
236}
237
238func showSuccess(w http.ResponseWriter, code string, tokenResp *TokenResponse, opts ServerOptions) {
239 log.Printf("SUCCESS: Token exchange completed")

Callers 1

mainFunction · 0.85

Calls 3

SetMethod · 0.65
HeaderMethod · 0.45
WriteHeaderMethod · 0.45

Tested by

no test coverage detected