mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
check that response writer has not been written too already
This commit is contained in:
@@ -194,9 +194,11 @@ func (hs *HTTPServer) Output(ctx context.Context, payload any) error {
|
|||||||
return errors.New("http.server is only able to output HTTPResponse")
|
return errors.New("http.server is only able to output HTTPResponse")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if responseWriter.done {
|
||||||
|
return errors.New("http.server response writer has already been written to")
|
||||||
|
}
|
||||||
|
|
||||||
responseWriter.WriteHeader(payloadResponse.Status)
|
responseWriter.WriteHeader(payloadResponse.Status)
|
||||||
|
|
||||||
responseWriter.Write(payloadResponse.Body)
|
responseWriter.Write(payloadResponse.Body)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user