summaryrefslogtreecommitdiff
path: root/cli/ops/fetch.rs
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2019-09-03 01:30:14 +0900
committerRyan Dahl <ry@tinyclouds.org>2019-09-02 12:30:14 -0400
commit56508f113d9fe61ffcce4cbbb85e3d6961888e1d (patch)
treecad7a845065462fa13c4dd68a749a0ee1d7f0d4a /cli/ops/fetch.rs
parent0ce15f08c76f075948a132dd0f9f27855bd00a1d (diff)
ops/fetch: add statusText (#2851)
Diffstat (limited to 'cli/ops/fetch.rs')
-rw-r--r--cli/ops/fetch.rs5
1 files changed, 3 insertions, 2 deletions
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
});