Update to hyper 0.13
This commit is contained in:
		
				
					committed by
					
						 Sean McArthur
						Sean McArthur
					
				
			
			
				
	
			
			
			
						parent
						
							db2de90e42
						
					
				
				
					commit
					0f32c4a01a
				
			| @@ -139,8 +139,8 @@ async fn fetch(req: Request) -> crate::Result<Response> { | ||||
|         .map_err(crate::error::request)?; | ||||
|  | ||||
|     // Convert from the js Response | ||||
|     let mut resp = http::Response::builder(); | ||||
|     resp.status(js_resp.status()); | ||||
|     let mut resp = http::Response::builder() | ||||
|         .status(js_resp.status()); | ||||
|  | ||||
|     let js_headers = js_resp.headers(); | ||||
|     let js_iter = js_sys::try_iter(&js_headers) | ||||
| @@ -150,7 +150,7 @@ async fn fetch(req: Request) -> crate::Result<Response> { | ||||
|     for item in js_iter { | ||||
|         let item = item.expect_throw("headers iterator doesn't throw"); | ||||
|         let v: Vec<String> = item.into_serde().expect_throw("headers into_serde"); | ||||
|         resp.header( | ||||
|         resp = resp.header( | ||||
|             v.get(0).expect_throw("headers name"), | ||||
|             v.get(1).expect_throw("headers value"), | ||||
|         ); | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| use http::HttpTryFrom; | ||||
| use std::convert::TryFrom; | ||||
| use std::fmt; | ||||
|  | ||||
| use http::Method; | ||||
| @@ -96,13 +96,15 @@ impl RequestBuilder { | ||||
|     /// Add a `Header` to this Request. | ||||
|     pub fn header<K, V>(mut self, key: K, value: V) -> RequestBuilder | ||||
|     where | ||||
|         HeaderName: HttpTryFrom<K>, | ||||
|         HeaderValue: HttpTryFrom<V>, | ||||
|         HeaderName: TryFrom<K>, | ||||
|         <HeaderName as TryFrom<K>>::Error: Into<http::Error>, | ||||
|         HeaderValue: TryFrom<V>, | ||||
|         <HeaderValue as TryFrom<V>>::Error: Into<http::Error>, | ||||
|     { | ||||
|         let mut error = None; | ||||
|         if let Ok(ref mut req) = self.request { | ||||
|             match <HeaderName as HttpTryFrom<K>>::try_from(key) { | ||||
|                 Ok(key) => match <HeaderValue as HttpTryFrom<V>>::try_from(value) { | ||||
|             match <HeaderName as TryFrom<K>>::try_from(key) { | ||||
|                 Ok(key) => match <HeaderValue as TryFrom<V>>::try_from(value) { | ||||
|                     Ok(value) => { | ||||
|                         req.headers_mut().append(key, value); | ||||
|                     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user