+type DispositionMiddleware struct {
+ handler http.Handler
+}
+
+func (m DispositionMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request) {
+ log.Println("path", r.URL.Path)
+ if r.URL.Path != "/file-downloads/" {
+ w.Header().Add("Content-Disposition", "attachment")
+ }
+ m.handler.ServeHTTP(w, r)
+}
+
+func applyDisposition(handler http.Handler) DispositionMiddleware {
+ return DispositionMiddleware{
+ handler: handler,
+ }
+}
+