Skip to content
This repository was archived by the owner on Oct 18, 2022. It is now read-only.

Remove strict check for Content-Length header #41

Merged
merged 1 commit into from
May 14, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,8 @@ pub mod http {
.header(ContentLength(body_len));
}

/// Checks that a reqwest `Response` has a status code indicating success and contains all
/// required headers.
///
/// In particular, the following headers must be present:
///
/// ```notrust
/// Content-Type: text/xml
/// Content-Length: <body length>
/// ```
/// Checks that a reqwest `Response` has a status code indicating success and verifies certain
/// headers.
pub fn check_response(response: &reqwest::Response) -> Result<(), Box<Error + Send + Sync>> {
// This is essentially an open-coded version of `Response::error_for_status` that does not
// consume the response.
Expand All @@ -117,9 +110,6 @@ pub mod http {
}
}

response.headers().get::<ContentLength>()
.ok_or_else(|| Box::<Error + Send + Sync>::from(format!("expected Content-Length header, but none was found")))?;

Ok(())
}

Expand Down