Skip to content

Commit

Permalink
use elapsed time from response
Browse files Browse the repository at this point in the history
  • Loading branch information
Huachao committed Apr 6, 2016
1 parent 80ed03a commit 004d885
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export function activate(context: ExtensionContext) {
headers: httpRequest.headers,
method: httpRequest.method,
body: httpRequest.body,
time: true,
followRedirect: restClientSettings.followRedirect
};

Expand All @@ -73,16 +74,14 @@ export function activate(context: ExtensionContext) {
}

// send http request
let startTime = new Date(Date.now());
request(options, function(error, response, body) {
statusBarItem.text = `$(cloud-download)`;
if (error) {
outChannel.appendLine(`${error}\n`);
outChannel.show(true);
return;
}
let endTime = new Date(Date.now());
let duration = endTime.valueOf() - startTime.valueOf();
let duration = response.elapsedTime;
let output = `HTTP/${response.httpVersion} ${response.statusCode} ${response.statusMessage}\n`
for (var header in response.headers) {
if (response.headers.hasOwnProperty(header)) {
Expand Down

0 comments on commit 004d885

Please sign in to comment.