@requestly/requestly-proxy 1.1.23 → 1.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,14 +22,14 @@ const createHarQueryStrings = (query_params) => {
22
22
  query_value.forEach(val => {
23
23
  res.push({
24
24
  "name": query,
25
- "value": val
25
+ "value": val !== null && val !== void 0 ? val : ""
26
26
  });
27
27
  });
28
28
  }
29
29
  else {
30
30
  res.push({
31
31
  "name": query,
32
- "value": query_value
32
+ "value": query_value !== null && query_value !== void 0 ? query_value : ""
33
33
  });
34
34
  }
35
35
  });
@@ -49,13 +49,8 @@ const bodyParser = (contentTypeHeader, buffer) => {
49
49
  };
50
50
  exports.bodyParser = bodyParser;
51
51
  const getContentType = (contentTypeHeader) => {
52
- if (!contentTypeHeader) {
53
- return null;
54
- }
55
- let contentType = null;
56
- // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type
57
- contentType = contentTypeHeader.split(";")[0];
58
- return contentType;
52
+ var _a;
53
+ return (_a = contentTypeHeader === null || contentTypeHeader === void 0 ? void 0 : contentTypeHeader.split(";")[0]) !== null && _a !== void 0 ? _a : null;
59
54
  };
60
55
  exports.getContentType = getContentType;
61
56
  const parseJsonBody = (data) => {
@@ -117,6 +117,7 @@ const modify_response_using_code = (action, ctx) => __awaiter(void 0, void 0, vo
117
117
  responseType: (_c = (_b = ctx === null || ctx === void 0 ? void 0 : ctx.serverToProxyResponse) === null || _b === void 0 ? void 0 : _b.headers) === null || _c === void 0 ? void 0 : _c["content-type"],
118
118
  requestHeaders: ctx.clientToProxyRequest.headers,
119
119
  requestData: (0, http_helpers_1.parseJsonBody)((_e = (_d = ctx.rq) === null || _d === void 0 ? void 0 : _d.final_request) === null || _e === void 0 ? void 0 : _e.body) || null,
120
+ statusCode: ctx.serverToProxyResponse.statusCode,
120
121
  };
121
122
  try {
122
123
  args.responseJSON = JSON.parse(args.response);
@@ -140,7 +140,19 @@ CA.create = function (caFolder, callback) {
140
140
  function (callback) {
141
141
  FS.exists(path.join(ca.certsFolder, "ca.pem"), function (exists) {
142
142
  if (exists) {
143
- ca.loadCA(callback);
143
+ // ca.loadCA(callback);
144
+ ca.loadCA(function (err) {
145
+ if (err) {
146
+ return callback(err);
147
+ }
148
+ if (ca.CAcert.validity.notAfter < new Date()) {
149
+ // generate the certificate again since it is expired
150
+ ca.generateCA(callback);
151
+ }
152
+ else {
153
+ return callback();
154
+ }
155
+ });
144
156
  }
145
157
  else {
146
158
  ca.generateCA(callback);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@requestly/requestly-proxy",
3
- "version": "1.1.23",
3
+ "version": "1.1.24",
4
4
  "description": "Proxy that gives superpowers to all the Requestly clients",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {