1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | const HttpApi = require("jsforce/lib/http-api");
|
11 | exports.request = HttpApi.prototype.request;
|
12 | exports.requestPerfMetrics = [];
|
13 | function getPerfMetricsFromResponse(response) {
|
14 | let metrics = response.headers['perfmetrics'];
|
15 |
|
16 | if (metrics) {
|
17 | let perfMetrics = {
|
18 | requestPath: response.req.path,
|
19 | perfMetrics: JSON.parse(metrics)
|
20 | };
|
21 | exports.requestPerfMetrics.push(perfMetrics);
|
22 | }
|
23 | }
|
24 | exports.getPerfMetricsFromResponse = getPerfMetricsFromResponse;
|
25 | HttpApi.prototype.request = function (req, ...args) {
|
26 | this.on('response', getPerfMetricsFromResponse);
|
27 | return exports.request.call(this, req, ...args);
|
28 | };
|
29 |
|
30 |
|