{"sha":"91f0d244bf1fb0a55255d234160f401ecbc7b287","node_id":"MDY6Q29tbWl0MjkwMjQzMTAxOjkxZjBkMjQ0YmYxZmIwYTU1MjU1ZDIzNDE2MGY0MDFlY2JjN2IyODc=","commit":{"author":{"name":"Fabrice Reix","email":"fabrice.reix@orange.com","date":"2020-11-22T07:40:28Z"},"committer":{"name":"Fabrice Reix","email":"fabrice.reix@orange.com","date":"2020-11-22T07:40:28Z"},"message":"Add duration in the http response","tree":{"sha":"4e974db478547d80b25fb753755e2e882fa43e53","url":"https://api.github.com/repos/Orange-OpenSource/hurl/git/trees/4e974db478547d80b25fb753755e2e882fa43e53"},"url":"https://api.github.com/repos/Orange-OpenSource/hurl/git/commits/91f0d244bf1fb0a55255d234160f401ecbc7b287","comment_count":0,"verification":{"verified":false,"reason":"unsigned","signature":null,"payload":null}},"url":"https://api.github.com/repos/Orange-OpenSource/hurl/commits/91f0d244bf1fb0a55255d234160f401ecbc7b287","html_url":"https://github.com/Orange-OpenSource/hurl/commit/91f0d244bf1fb0a55255d234160f401ecbc7b287","comments_url":"https://api.github.com/repos/Orange-OpenSource/hurl/commits/91f0d244bf1fb0a55255d234160f401ecbc7b287/comments","author":{"login":"fabricereix","id":682123,"node_id":"MDQ6VXNlcjY4MjEyMw==","avatar_url":"https://avatars2.githubusercontent.com/u/682123?v=4","gravatar_id":"","url":"https://api.github.com/users/fabricereix","html_url":"https://github.com/fabricereix","followers_url":"https://api.github.com/users/fabricereix/followers","following_url":"https://api.github.com/users/fabricereix/following{/other_user}","gists_url":"https://api.github.com/users/fabricereix/gists{/gist_id}","starred_url":"https://api.github.com/users/fabricereix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabricereix/subscriptions","organizations_url":"https://api.github.com/users/fabricereix/orgs","repos_url":"https://api.github.com/users/fabricereix/repos","events_url":"https://api.github.com/users/fabricereix/events{/privacy}","received_events_url":"https://api.github.com/users/fabricereix/received_events","type":"User","site_admin":false},"committer":{"login":"fabricereix","id":682123,"node_id":"MDQ6VXNlcjY4MjEyMw==","avatar_url":"https://avatars2.githubusercontent.com/u/682123?v=4","gravatar_id":"","url":"https://api.github.com/users/fabricereix","html_url":"https://github.com/fabricereix","followers_url":"https://api.github.com/users/fabricereix/followers","following_url":"https://api.github.com/users/fabricereix/following{/other_user}","gists_url":"https://api.github.com/users/fabricereix/gists{/gist_id}","starred_url":"https://api.github.com/users/fabricereix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabricereix/subscriptions","organizations_url":"https://api.github.com/users/fabricereix/orgs","repos_url":"https://api.github.com/users/fabricereix/repos","events_url":"https://api.github.com/users/fabricereix/events{/privacy}","received_events_url":"https://api.github.com/users/fabricereix/received_events","type":"User","site_admin":false},"parents":[{"sha":"b8a19f0b6a3dbcd9ddf41d935dac16c66051c6bb","url":"https://api.github.com/repos/Orange-OpenSource/hurl/commits/b8a19f0b6a3dbcd9ddf41d935dac16c66051c6bb","html_url":"https://github.com/Orange-OpenSource/hurl/commit/b8a19f0b6a3dbcd9ddf41d935dac16c66051c6bb"}],"stats":{"total":44,"additions":40,"deletions":4},"files":[{"sha":"f5e152ac917345eb8768df1d95f210571981bd30","filename":"packages/hurl/src/http/client.rs","status":"modified","additions":4,"deletions":0,"changes":4,"blob_url":"https://github.com/Orange-OpenSource/hurl/blob/91f0d244bf1fb0a55255d234160f401ecbc7b287/packages/hurl/src/http/client.rs","raw_url":"https://github.com/Orange-OpenSource/hurl/raw/91f0d244bf1fb0a55255d234160f401ecbc7b287/packages/hurl/src/http/client.rs","contents_url":"https://api.github.com/repos/Orange-OpenSource/hurl/contents/packages/hurl/src/http/client.rs?ref=91f0d244bf1fb0a55255d234160f401ecbc7b287","patch":"@@ -23,6 +23,7 @@ use curl::easy;\n use encoding::all::ISO_8859_1;\n use encoding::{DecoderTrap, Encoding};\n use std::time::Duration;\n+use std::time::Instant;\n \n use super::core::*;\n use super::request::*;\n@@ -161,6 +162,7 @@ impl Client {\n })\n .unwrap();\n \n+ let start = Instant::now();\n let mut status_lines = vec![];\n let mut headers = vec![];\n let mut body = Vec::::new();\n@@ -237,6 +239,7 @@ impl Client {\n \n return self.execute(&request, redirect_count);\n }\n+ let duration = start.elapsed();\n self.redirect_count = redirect_count;\n self.reset();\n \n@@ -245,6 +248,7 @@ impl Client {\n status,\n headers,\n body,\n+ duration,\n })\n }\n "},{"sha":"4c9db7248629976b7a31585cac6dfd3b8cc6af0d","filename":"packages/hurl/src/http/response.rs","status":"modified","additions":10,"deletions":0,"changes":10,"blob_url":"https://github.com/Orange-OpenSource/hurl/blob/91f0d244bf1fb0a55255d234160f401ecbc7b287/packages/hurl/src/http/response.rs","raw_url":"https://github.com/Orange-OpenSource/hurl/raw/91f0d244bf1fb0a55255d234160f401ecbc7b287/packages/hurl/src/http/response.rs","contents_url":"https://api.github.com/repos/Orange-OpenSource/hurl/contents/packages/hurl/src/http/response.rs?ref=91f0d244bf1fb0a55255d234160f401ecbc7b287","patch":"@@ -17,6 +17,7 @@\n */\n \n use core::fmt;\n+use std::time::Duration;\n \n use super::core::*;\n \n@@ -26,6 +27,7 @@ pub struct Response {\n pub status: u32,\n pub headers: Vec
,\n pub body: Vec,\n+ pub duration: Duration,\n }\n \n #[derive(Clone, Debug, PartialEq, Eq)]\n@@ -97,6 +99,7 @@ pub mod tests {\n },\n ],\n body: String::into_bytes(String::from(\"Hello World!\")),\n+ duration: Default::default(),\n }\n }\n \n@@ -111,6 +114,7 @@ pub mod tests {\n body: String::into_bytes(String::from(\n \"
\",\n )),\n+ duration: Default::default(),\n }\n }\n \n@@ -134,6 +138,7 @@ xxx\n \"#\n .to_string(),\n ),\n+ duration: Default::default(),\n }\n }\n \n@@ -161,6 +166,7 @@ xxx\n \"#\n .to_string(),\n ),\n+ duration: Default::default(),\n }\n }\n \n@@ -189,6 +195,7 @@ xxx\n \"#\n .to_string(),\n ),\n+ duration: Default::default(),\n }\n }\n \n@@ -210,6 +217,7 @@ xxx\n \"#\n .to_string(),\n ),\n+ duration: Default::default(),\n }\n }\n \n@@ -228,6 +236,7 @@ xxx\n },\n ],\n body: vec![255],\n+ duration: Default::default(),\n }\n }\n \n@@ -241,6 +250,7 @@ xxx\n value: \"12\".to_string(),\n }],\n body: vec![],\n+ duration: Default::default(),\n };\n assert_eq!(\n response.get_header_values(\"Content-Length\".to_string()),"},{"sha":"884e20589b3a18cffee1b788008a977f141c86bb","filename":"packages/hurl/src/runner/content_decoding.rs","status":"modified","additions":7,"deletions":0,"changes":7,"blob_url":"https://github.com/Orange-OpenSource/hurl/blob/91f0d244bf1fb0a55255d234160f401ecbc7b287/packages/hurl/src/runner/content_decoding.rs","raw_url":"https://github.com/Orange-OpenSource/hurl/raw/91f0d244bf1fb0a55255d234160f401ecbc7b287/packages/hurl/src/runner/content_decoding.rs","contents_url":"https://api.github.com/repos/Orange-OpenSource/hurl/contents/packages/hurl/src/runner/content_decoding.rs?ref=91f0d244bf1fb0a55255d234160f401ecbc7b287","patch":"@@ -138,6 +138,7 @@ pub mod tests {\n status: 200,\n headers: vec![],\n body: vec![],\n+ duration: Default::default(),\n };\n assert_eq!(response.content_encoding().unwrap(), vec![]);\n \n@@ -149,6 +150,7 @@ pub mod tests {\n value: \"xx\".to_string(),\n }],\n body: vec![],\n+ duration: Default::default(),\n };\n assert_eq!(\n response.content_encoding().err().unwrap(),\n@@ -163,6 +165,7 @@ pub mod tests {\n value: \"br\".to_string(),\n }],\n body: vec![],\n+ duration: Default::default(),\n };\n assert_eq!(response.content_encoding().unwrap(), vec![Encoding::Brotli]);\n }\n@@ -177,6 +180,7 @@ pub mod tests {\n value: \"br, identity\".to_string(),\n }],\n body: vec![],\n+ duration: Default::default(),\n };\n assert_eq!(\n response.content_encoding().unwrap(),\n@@ -197,6 +201,7 @@ pub mod tests {\n 0x21, 0x2c, 0x00, 0x04, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c,\n 0x64, 0x21,\n ],\n+ duration: Default::default(),\n };\n assert_eq!(response.uncompress_body().unwrap(), b\"Hello World!\");\n \n@@ -211,6 +216,7 @@ pub mod tests {\n 0x21, 0x2c, 0x00, 0x04, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c,\n 0x64, 0x21,\n ],\n+ duration: Default::default(),\n };\n assert_eq!(response.uncompress_body().unwrap(), b\"Hello World!\");\n \n@@ -219,6 +225,7 @@ pub mod tests {\n status: 200,\n headers: vec![],\n body: b\"Hello World!\".to_vec(),\n+ duration: Default::default(),\n };\n assert_eq!(response.uncompress_body().unwrap(), b\"Hello World!\");\n }"},{"sha":"a8fa81e37e94291f4d58ee2e9b69b47c265d09de","filename":"packages/hurl/src/runner/entry.rs","status":"modified","additions":2,"deletions":4,"changes":6,"blob_url":"https://github.com/Orange-OpenSource/hurl/blob/91f0d244bf1fb0a55255d234160f401ecbc7b287/packages/hurl/src/runner/entry.rs","raw_url":"https://github.com/Orange-OpenSource/hurl/raw/91f0d244bf1fb0a55255d234160f401ecbc7b287/packages/hurl/src/runner/entry.rs","contents_url":"https://api.github.com/repos/Orange-OpenSource/hurl/contents/packages/hurl/src/runner/entry.rs?ref=91f0d244bf1fb0a55255d234160f401ecbc7b287","patch":"@@ -16,7 +16,6 @@\n *\n */\n use std::collections::HashMap;\n-use std::time::Instant;\n \n use crate::http;\n use crate::http::HttpError;\n@@ -100,7 +99,6 @@ pub fn run(\n log_verbose(\"\");\n log_request(log_verbose, &http_request);\n \n- let start = Instant::now();\n let http_response = match http_client.execute(&http_request, 0) {\n Ok(response) => response,\n Err(http_error) => {\n@@ -140,8 +138,8 @@ pub fn run(\n }\n };\n \n- let time_in_ms = start.elapsed().as_millis();\n- log_verbose(format!(\"Response Time: {}ms\", time_in_ms).as_str());\n+ let time_in_ms = http_response.duration.as_millis();\n+ log_verbose(format!(\"Response Time: {}ms\", time_in_ms.to_string()).as_str());\n \n let captures = match entry.response.clone() {\n None => vec![],"},{"sha":"51d11119a4155a359e95f483844156652b1ab0ae","filename":"packages/hurl/src/runner/http_response.rs","status":"modified","additions":6,"deletions":0,"changes":6,"blob_url":"https://github.com/Orange-OpenSource/hurl/blob/91f0d244bf1fb0a55255d234160f401ecbc7b287/packages/hurl/src/runner/http_response.rs","raw_url":"https://github.com/Orange-OpenSource/hurl/raw/91f0d244bf1fb0a55255d234160f401ecbc7b287/packages/hurl/src/runner/http_response.rs","contents_url":"https://api.github.com/repos/Orange-OpenSource/hurl/contents/packages/hurl/src/runner/http_response.rs?ref=91f0d244bf1fb0a55255d234160f401ecbc7b287","patch":"@@ -121,6 +121,7 @@ pub mod tests {\n status: 200,\n headers: vec![],\n body: b\"Hello World!\".to_vec(),\n+ duration: Default::default(),\n }\n }\n \n@@ -133,6 +134,7 @@ pub mod tests {\n value: \"text/plain; charset=utf-8\".to_string(),\n }],\n body: vec![0x63, 0x61, 0x66, 0xc3, 0xa9],\n+ duration: Default::default(),\n }\n }\n \n@@ -145,6 +147,7 @@ pub mod tests {\n value: \"text/plain; charset=ISO-8859-1\".to_string(),\n }],\n body: vec![0x63, 0x61, 0x66, 0xe9],\n+ duration: Default::default(),\n }\n }\n \n@@ -192,6 +195,7 @@ pub mod tests {\n value: \"test/plain; charset=xxx\".to_string()\n }],\n body: b\"Hello World!\".to_vec(),\n+ duration: Default::default()\n }\n .encoding()\n .err()\n@@ -210,6 +214,7 @@ pub mod tests {\n status: 200,\n headers: vec![],\n body: vec![0x63, 0x61, 0x66, 0xe9],\n+ duration: Default::default()\n }\n .text()\n .err()\n@@ -228,6 +233,7 @@ pub mod tests {\n value: \"text/plain; charset=ISO-8859-1\".to_string()\n }],\n body: vec![0x63, 0x61, 0x66, 0xc3, 0xa9],\n+ duration: Default::default()\n }\n .text()\n .unwrap(),"},{"sha":"43263fb40193fc23890975251211ac8ec1cee653","filename":"packages/hurl/src/runner/log_deserialize.rs","status":"modified","additions":6,"deletions":0,"changes":6,"blob_url":"https://github.com/Orange-OpenSource/hurl/blob/91f0d244bf1fb0a55255d234160f401ecbc7b287/packages/hurl/src/runner/log_deserialize.rs","raw_url":"https://github.com/Orange-OpenSource/hurl/raw/91f0d244bf1fb0a55255d234160f401ecbc7b287/packages/hurl/src/runner/log_deserialize.rs","contents_url":"https://api.github.com/repos/Orange-OpenSource/hurl/contents/packages/hurl/src/runner/log_deserialize.rs?ref=91f0d244bf1fb0a55255d234160f401ecbc7b287","patch":"@@ -20,6 +20,7 @@ use crate::http::*;\n \n use super::cookie::*;\n use super::core::*;\n+use std::time::Duration;\n \n type ParseError = String;\n \n@@ -208,11 +209,15 @@ pub fn parse_response(value: serde_json::Value) -> Result\n _ => vec![],\n };\n \n+ // TODO: Check if you need it\n+ let duration = Duration::new(0, 0);\n+\n Ok(Response {\n version,\n status,\n headers,\n body: vec![],\n+ duration,\n })\n } else {\n Err(\"expecting an object for the response\".to_string())\n@@ -461,6 +466,7 @@ mod tests {\n },\n ],\n body: vec![],\n+ duration: Default::default()\n }\n );\n }"},{"sha":"d136eec1b00488e6e265e03a401f35884ed4e7a8","filename":"packages/hurl/src/runner/query.rs","status":"modified","additions":5,"deletions":0,"changes":5,"blob_url":"https://github.com/Orange-OpenSource/hurl/blob/91f0d244bf1fb0a55255d234160f401ecbc7b287/packages/hurl/src/runner/query.rs","raw_url":"https://github.com/Orange-OpenSource/hurl/raw/91f0d244bf1fb0a55255d234160f401ecbc7b287/packages/hurl/src/runner/query.rs","contents_url":"https://api.github.com/repos/Orange-OpenSource/hurl/contents/packages/hurl/src/runner/query.rs?ref=91f0d244bf1fb0a55255d234160f401ecbc7b287","patch":"@@ -345,6 +345,7 @@ pub mod tests {\n \"#\n .to_string(),\n ),\n+ duration: Default::default(),\n }\n }\n \n@@ -550,6 +551,7 @@ pub mod tests {\n }\n ],\n body: vec![],\n+ duration: Default::default()\n };\n \n // cookie \"LSID\"\n@@ -781,6 +783,7 @@ pub mod tests {\n status: 0,\n headers: vec![],\n body: vec![200],\n+ duration: Default::default(),\n };\n let error = eval_query(xpath_users(), &variables, http_response)\n .err()\n@@ -932,6 +935,7 @@ pub mod tests {\n status: 0,\n headers: vec![],\n body: String::into_bytes(String::from(\"xxx\")),\n+ duration: Default::default(),\n };\n let error = eval_query(jsonpath_success(), &variables, http_response)\n .err()\n@@ -948,6 +952,7 @@ pub mod tests {\n status: 0,\n headers: vec![],\n body: String::into_bytes(String::from(\"{}\")),\n+ duration: Default::default(),\n };\n //assert_eq!(jsonpath_success().eval(http_response).unwrap(), Value::List(vec![]));\n assert_eq!("}]}