MCPcopy Create free account
hub / github.com/quay/clair / writerError

Function writerError

httptransport/server.go:153–162  ·  view source on GitHub ↗

WriterError is a helper that closes over an error that may be returned after writing a response body starts. The normal error flow can't be used, because the HTTP status code will have been sent and some amount of body data may have been written. To use this, make sure an error variable is predecl

(w http.ResponseWriter, e *error)

Source from the content-addressed store, hash-verified

151// defer writerError(w, &err)()
152// _, err = fallibleWrite(w)
153func writerError(w http.ResponseWriter, e *error) func() {
154 const errHeader = `Clair-Error`
155 w.Header().Add("trailer", errHeader)
156 return func() {
157 if *e == nil {
158 return
159 }
160 w.Header().Add(errHeader, (*e).Error())
161 }
162}
163
164// SetCacheControl sets the "Cache-Control" header on the response.
165func setCacheControl(w http.ResponseWriter, age time.Duration) {

Callers 9

DiscoveryHandlerFunction · 0.85
getMethod · 0.85
indexReportMethod · 0.85
indexReportOneMethod · 0.85
indexStateMethod · 0.85
affectedManifestsMethod · 0.85
vulnerabilityReportMethod · 0.85
updateDiffHandlerMethod · 0.85

Calls 2

AddMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected