mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-20 23:41:23 +02: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.
|
// modifyResponse implements ResponseModifier.
|
||||||
func (m *modifyHTML) modifyResponse(resp *http.Response) error {
|
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
|
// including text/html and application/xhtml+xml
|
||||||
if !httputils.GetContentType(resp.Header).IsHTML() {
|
if !httputils.GetContentType(resp.Header).IsHTML() {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user