(req *http.Request)
| 198 | } |
| 199 | |
| 200 | func (c *Command) ModifyRequest(req *http.Request) error { |
| 201 | if c.global.Devtools.HijackPath != "" && req.URL.Path == c.global.Devtools.HijackPath { |
| 202 | conn, brw, err := martian.NewContext(req).Session().Hijack() |
| 203 | if err != nil { |
| 204 | return fmt.Errorf("subtrace: failed to hijack devtools endpoint: %w", err) |
| 205 | } |
| 206 | |
| 207 | c.global.Devtools.HandleHijack(req, conn, brw) |
| 208 | return nil |
| 209 | } |
| 210 | |
| 211 | suffix := req.URL.EscapedPath() |
| 212 | if !strings.HasPrefix(suffix, "/") { |
| 213 | suffix = "/" + suffix |
| 214 | } |
| 215 | if req.URL.RawQuery != "" { |
| 216 | suffix += "?" + req.URL.RawQuery |
| 217 | } |
| 218 | |
| 219 | u, err := url.Parse(fmt.Sprintf("http://0.0.0.0:%d", c.to) + suffix) |
| 220 | if err != nil { |
| 221 | return fmt.Errorf("parse remote addr: %w", err) |
| 222 | } |
| 223 | |
| 224 | req.URL = u |
| 225 | req.Header.Del("accept-encoding") |
| 226 | return nil |
| 227 | } |
| 228 | |
| 229 | func (c *Command) RoundTrip(req *http.Request) (*http.Response, error) { |
| 230 | event := c.global.Config.GetEventTemplate() |
nothing calls this directly
no test coverage detected