MCPcopy
hub / github.com/labstack/echo / UnwrapResponse

Function UnwrapResponse

response.go:120–132  ·  view source on GitHub ↗

UnwrapResponse unwraps given ResponseWriter to return contexts original Echo Response. rw has to implement following method `Unwrap() http.ResponseWriter`

(rw http.ResponseWriter)

Source from the content-addressed store, hash-verified

118// UnwrapResponse unwraps given ResponseWriter to return contexts original Echo Response. rw has to implement
119// following method `Unwrap() http.ResponseWriter`
120func UnwrapResponse(rw http.ResponseWriter) (*Response, error) {
121 for {
122 switch t := rw.(type) {
123 case *Response:
124 return t, nil
125 case interface{ Unwrap() http.ResponseWriter }:
126 rw = t.Unwrap()
127 continue
128 default:
129 return nil, errors.New("ResponseWriter does not implement 'Unwrap() http.ResponseWriter' interface or unwrap to *echo.Response")
130 }
131 }
132}
133
134// delayedStatusWriter is a wrapper around http.ResponseWriter that delays writing the status code until first Write is called.
135// This allows (global) error handler to decide correct status code to be sent to the client.

Callers 4

DefaultHTTPErrorHandlerFunction · 0.85
ResolveResponseStatusFunction · 0.85

Calls 1

UnwrapMethod · 0.45

Tested by 2

Used in the wild real call sites across dependent graphs

searching dependent graphs…