MCPcopy Index your code
hub / github.com/supabase/auth / finallyWrite

Method finallyWrite

internal/api/middleware.go:503–520  ·  view source on GitHub ↗
(w http.ResponseWriter)

Source from the content-addressed store, hash-verified

501}
502
503func (t *timeoutResponseWriter) finallyWrite(w http.ResponseWriter) {
504 t.Lock()
505 defer t.Unlock()
506
507 dst := w.Header()
508 for k, vv := range t.snapHeader {
509 dst[k] = vv
510 }
511
512 if !t.wroteHeader {
513 t.statusCode = http.StatusOK
514 }
515
516 w.WriteHeader(t.statusCode)
517 if _, err := w.Write(t.buf.Bytes()); err != nil {
518 logrus.WithError(err).Warn("Write failed")
519 }
520}
521
522// limitRequestBody wraps the request body with http.MaxBytesReader to prevent
523// memory exhaustion from excessively large request bodies (gosec G120).

Callers 1

timeoutMiddlewareFunction · 0.95

Calls 3

HeaderMethod · 0.45
WriteHeaderMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected