Fixes mockdispatcher to use typed return codes.
//! Mock request dispatcher and credentials for unit testing services
+use std::fs::File;
+use std::io::Read;
+use std::collections::HashMap;
+
use super::{DispatchSignedRequest, HttpResponse, HttpDispatchError, SignedRequest};
use super::{ProvideAwsCredentials, CredentialsError, AwsCredentials};
use chrono::{Duration, UTC};
-use std::fs::File;
-use std::io::Read;
+use hyper::status::StatusCode;
const ONE_DAY: i64 = 86400;
@@ -22,8 +25,12 @@ pub struct MockRequestDispatcher {
impl MockRequestDispatcher {
pub fn with_status(status: u16) -> MockRequestDispatcher {
- let mut response = HttpResponse::default();
- response.status = status;
+ let response = HttpResponse {
+ status: StatusCode::from_u16(status),
+ body: "".to_string(),
+ headers: HashMap::new(),
+ };
+
MockRequestDispatcher {
mock_response: response,
request_checker: None
