Skip to content

http: superfluous response #31

@RecordingTheSmile

Description

@RecordingTheSmile

When I set response body in function Connect, I got this when I run it:

http: superfluous response.WriteHeader call from github.com/ouqiang/goproxy.(*Proxy).httpProxy.func1 (proxy.go:340)

The code I set the response body:

func (e *EventHandler) Connect(ctx *goproxy.Context, rw http.ResponseWriter) {
	if ctx.Req.Host == "test.com" {
			rw.Header().Set("Content-Type", "text/html; charset=utf-8")
			_, _ = rw.Write([]byte("<!doctype html><html><head><title>Hello, World!</title></head><body><h1 style='text-align:center;'>Hello, World!</h1></body></html>"))
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions