(
body: HttpBody,
mut headers: HttpHeaders,
id: HttpID,
url: &str,
)
| 611 | } |
| 612 | } else { |
| 613 | match build_agent(config) { |
| 614 | Ok(agent) => agent, |
| 615 | Err(err) => { |
| 616 | return HttpEvent::Failed(HttpError::new( |
| 617 | id, |
| 618 | url, |
| 619 | HttpErrorKind::Config, |
| 620 | err.to_string(), |
| 621 | )); |
| 622 | } |
| 623 | } |
| 624 | }; |
| 625 | |
| 626 | match send_request(&agent, config, id, request) { |
| 627 | Ok(response) => { |
| 628 | if (400..=599).contains(&response.status) { |
| 629 | HttpEvent::Failed(HttpError::new( |
| 630 | id, |
| 631 | response.url, |
| 632 | HttpErrorKind::Status, |
| 633 | format!("http status {}", response.status), |
| 634 | )) |
| 635 | } else { |
| 636 | HttpEvent::Completed(response) |
| 637 | } |
| 638 | } |
| 639 | Err(err) => HttpEvent::Failed(err), |
| 640 | } |
no test coverage detected