FetchResponse fetches the HTTP response for the given URL.
(u string, method string, headers http.Header)
| 17 | |
| 18 | // FetchResponse fetches the HTTP response for the given URL. |
| 19 | func FetchResponse(u string, method string, headers http.Header) (*http.Response, error) { |
| 20 | req, err := http.NewRequest(method, u, nil) |
| 21 | if err != nil { |
| 22 | return nil, err |
| 23 | } |
| 24 | |
| 25 | req.Header = headers |
| 26 | |
| 27 | return http.DefaultClient.Do(req) |
| 28 | } |
| 29 | |
| 30 | // ExtractSources extracts all JavaScript sources found in the provided HTTP response reader. |
| 31 | // The optional extractionPoints can be used to overwrite the default extraction points map |