MCPcopy Create free account
hub / github.com/PerroEngine/Perro / encode_body

Function encode_body

perro_source/api_modules/perro_networking/src/http.rs:613–637  ·  view source on GitHub ↗
(
    body: HttpBody,
    mut headers: HttpHeaders,
    id: HttpID,
    url: &str,
)

Source from the content-addressed store, hash-verified

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 }

Callers 1

send_requestFunction · 0.85

Calls 4

anyMethod · 0.80
to_json_valueMethod · 0.80
iterMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected