// NewLogger returns a logger that logs requests and responses. Log function defaults to martian.Infof. func NewLogger() *Logger { return &Logger{ log: func(line string) { martian.Infof(line) }, } }
// ModifyResponse sets cookie on the response. func (m *modifier) ModifyResponse(res *http.Response) error { res.Header.Add("Set-Cookie", m.cookie.String()) martian.Infof("%s: add cookie: %s", res.Request.URL, m.cookie) return nil }
// ModifyRequest adds cookie to the request. func (m *modifier) ModifyRequest(req *http.Request) error { req.AddCookie(m.cookie) martian.Infof("%s: add cookie: %s", req.URL, m.cookie) return nil }