MCPcopy Index your code
hub / github.com/aws/aws-lambda-go / writeHeader

Method writeHeader

lambdaurl/http_handler.go:72–81  ·  view source on GitHub ↗
(statusCode int, initialPayload []byte)

Source from the content-addressed store, hash-verified

70}
71
72func (w *httpResponseWriter) writeHeader(statusCode int, initialPayload []byte) {
73 w.once.Do(func() {
74 if w.detectContentType {
75 if w.Header().Get("Content-Type") == "" {
76 w.Header().Set("Content-Type", detectContentType(initialPayload))
77 }
78 }
79 w.ready <- header{code: statusCode, header: w.header}
80 })
81}
82
83func detectContentType(p []byte) string {
84 // http.DetectContentType returns "text/plain; charset=utf-8" for nil and zero-length byte slices.

Callers 2

WriteMethod · 0.95
WriteHeaderMethod · 0.95

Calls 3

HeaderMethod · 0.95
detectContentTypeFunction · 0.85
DoMethod · 0.65

Tested by

no test coverage detected