mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-25 10:31:30 +01:00
fix(middleware): skip modification for HEAD requests in ModifyHTML middleware
This commit is contained in:
@@ -40,6 +40,10 @@ func (eofReader) Close() error { return nil }
|
||||
|
||||
// modifyResponse implements ResponseModifier.
|
||||
func (m *modifyHTML) modifyResponse(resp *http.Response) error {
|
||||
// Skip HEAD requests - no body to modify
|
||||
if resp.Request.Method == http.MethodHead {
|
||||
return nil
|
||||
}
|
||||
// including text/html and application/xhtml+xml
|
||||
if !httputils.GetContentType(resp.Header).IsHTML() {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user