From 56508f113d9fe61ffcce4cbbb85e3d6961888e1d Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Tue, 3 Sep 2019 01:30:14 +0900 Subject: ops/fetch: add statusText (#2851) --- cli/ops/fetch.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cli/ops/fetch.rs') diff --git a/cli/ops/fetch.rs b/cli/ops/fetch.rs index afda07f75..f69065f1d 100644 --- a/cli/ops/fetch.rs +++ b/cli/ops/fetch.rs @@ -50,7 +50,7 @@ pub fn op_fetch( } debug!("Before fetch {}", url); let future = request.send().map_err(ErrBox::from).and_then(move |res| { - let status = res.status().as_u16(); + let status = res.status(); let mut res_headers = Vec::new(); for (key, val) in res.headers().iter() { res_headers.push((key.to_string(), val.to_str().unwrap().to_owned())); @@ -61,7 +61,8 @@ pub fn op_fetch( let json_res = json!({ "bodyRid": body_resource.rid, - "status": status, + "status": status.as_u16(), + "statusText": status.canonical_reason().unwrap_or(""), "headers": res_headers }); -- cgit v1.2.3