mirror of
https://git.sr.ht/~adnano/go-gemini
synced 2024-11-22 20:01:59 +01:00
LoggingMiddleware: Prevent writing empty meta
This commit is contained in:
parent
08fac3bf87
commit
7e585304a2
@ -31,7 +31,12 @@ func (w *logResponseWriter) SetMediaType(mediatype string) {
|
||||
|
||||
func (w *logResponseWriter) Write(b []byte) (int, error) {
|
||||
if !w.wroteHeader {
|
||||
w.WriteHeader(StatusSuccess, w.mediatype)
|
||||
meta := w.mediatype
|
||||
if meta == "" {
|
||||
// Use default media type
|
||||
meta = defaultMediaType
|
||||
}
|
||||
w.WriteHeader(StatusSuccess, meta)
|
||||
}
|
||||
n, err := w.rw.Write(b)
|
||||
w.Wrote += n
|
||||
|
Loading…
Reference in New Issue
Block a user