Add more header validation (#188)
This adds validation of header values on receive, and of both header names and header values on send. This doesn't change the return type of set to be a Result, it just validates when the request is sent. Also removes the section in the README describing handling of invalid headers, and updates a test that verified acceptance of non-ASCII headers so that it verifies rejection of them instead.
This commit is contained in:
committed by
GitHub
parent
e36c1c2aa1
commit
044f25b02a
@@ -112,6 +112,9 @@ impl Request {
|
||||
}
|
||||
|
||||
fn do_call(&self, payload: Payload) -> Result<Response> {
|
||||
for h in &self.headers {
|
||||
h.validate()?;
|
||||
}
|
||||
let response = self.to_url().and_then(|url| {
|
||||
let reader = payload.into_read();
|
||||
let unit = Unit::new(&self, &url, true, &reader);
|
||||
|
||||
Reference in New Issue
Block a user