diff options
author | Vincent Ambo <mail@tazj.in> | 2019-02-26T16·58+0100 |
---|---|---|
committer | Vincent Ambo <mail@tazj.in> | 2019-02-26T16·58+0100 |
commit | a039908fc4696070936549304586af65a272cc12 (patch) | |
tree | c2e968f764056053cfd83de1aa3b313e737c935a /src/tests.rs | |
parent | cf58060fccb68088b1a9f82f484f1f8b635fa61e (diff) |
test: Add timeouts to HTTP POST tests
Occasionally (and seemingly most commonly in travis-ci), httpbin does not respond to POST requests.
Diffstat (limited to 'src/tests.rs')
-rw-r--r-- | src/tests.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/tests.rs b/src/tests.rs index 97798dbcdd26..c240f55ae199 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -44,6 +44,7 @@ fn test_http_post() { let body = "test body"; let response = Request::new(Method::Post, "https://httpbin.org/post") .user_agent("crimp test suite").expect("failed to set user-agent") + .timeout(Duration::from_secs(5)).expect("failed to set request timeout") .body("text/plain", &body.as_bytes()) .send().expect("failed to send request") .as_json::<Value>().expect("failed to deserialize response"); @@ -70,6 +71,7 @@ fn test_http_post_json() { let response = Request::new(Method::Post, "https://httpbin.org/post") .user_agent("crimp test suite").expect("failed to set user-agent") + .timeout(Duration::from_secs(5)).expect("failed to set request timeout") .json(&body).expect("request serialization failed") .send().expect("failed to send request") .as_json::<Value>().expect("failed to deserialize response"); |