MCPcopy
hub / github.com/tdewolff/minify / ResponseWriter

Method ResponseWriter

minify.go:357–360  ·  view source on GitHub ↗

ResponseWriter minifies any writes to the http.ResponseWriter. http.ResponseWriter loses all functionality such as Pusher, Hijacker, Flusher, ... Minification might be slower than just sending the original file! Caching is advised.

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

355// http.ResponseWriter loses all functionality such as Pusher, Hijacker, Flusher, ...
356// Minification might be slower than just sending the original file! Caching is advised.
357func (m *M) ResponseWriter(w http.ResponseWriter, r *http.Request) *responseWriter {
358 mediatype := mime.TypeByExtension(path.Ext(r.RequestURI))
359 return &responseWriter{w, nil, m, mediatype}
360}
361
362// Middleware provides a middleware function that minifies content on the fly by intercepting writes to http.ResponseWriter.
363// http.ResponseWriter loses all functionality such as Pusher, Hijacker, Flusher, ...

Callers 3

MiddlewareMethod · 0.95
MiddlewareWithErrorMethod · 0.95
TestResponseWriterFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestResponseWriterFunction · 0.64