zapier-platform-core 16.4.0 → 16.5.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zapier-platform-core",
3
- "version": "16.4.0",
3
+ "version": "16.5.1",
4
4
  "description": "The core SDK for CLI apps in the Zapier Developer Platform.",
5
5
  "repository": "zapier/zapier-platform",
6
6
  "homepage": "https://platform.zapier.com/",
@@ -53,7 +53,7 @@
53
53
  "node-fetch": "2.7.0",
54
54
  "oauth-sign": "0.9.0",
55
55
  "semver": "7.6.3",
56
- "zapier-platform-schema": "16.4.0"
56
+ "zapier-platform-schema": "16.5.1"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/node-fetch": "^2.6.11",
@@ -14,7 +14,9 @@ const addQueryParams = (req) => {
14
14
 
15
15
  normalizeEmptyParamFields(req);
16
16
 
17
- let stringifiedParams = querystring.stringify(req.params);
17
+ let stringifiedParams = querystring.stringify(req.params, '&', '=', {
18
+ encodeURIComponent: req.encodeURIComponent,
19
+ });
18
20
 
19
21
  // it goes against spec, but for compatibility, some APIs want certain
20
22
  // characters (mostly $) unencoded
@@ -59,6 +59,9 @@ const createHttpPatch = (event) => {
59
59
 
60
60
  // Only include request or response data for specific content types
61
61
  // which we are able to read in logs and which are not typically too large
62
+ // Limitation: This doesn't capture the request content-type if it's set afterwards, like:
63
+ // const req = https.request(options, callback);
64
+ // req.setHeader('Content-Type', 'text/plain');
62
65
  const requestContentType = getContentType(options.headers || {});
63
66
  const responseContentType = getContentType(response.headers || {});
64
67
 
package/src/tools/http.js CHANGED
@@ -25,19 +25,17 @@ const ALLOWED_HTTP_DATA_CONTENT_TYPES = new Set([
25
25
  ]);
26
26
 
27
27
  const getContentType = (headers) => {
28
- const headerKeys = Object.keys(headers);
29
- let foundKey = '';
30
-
31
- _.each(headerKeys, (key) => {
28
+ for (const [key, value] of Object.entries(headers)) {
32
29
  if (key.toLowerCase() === 'content-type') {
33
- foundKey = key;
34
- return false;
30
+ if (Array.isArray(value) && value.length > 0) {
31
+ return value[0];
32
+ } else if (typeof value === 'string') {
33
+ return value;
34
+ }
35
+ return null;
35
36
  }
36
-
37
- return true;
38
- });
39
-
40
- return _.get(headers, foundKey, '');
37
+ }
38
+ return null;
41
39
  };
42
40
 
43
41
  // This function splits a comma-separated string described by RFC 2068 Section 2.
@@ -4,7 +4,7 @@
4
4
  * files, and/or the schema-to-ts tool and run its CLI to regenerate
5
5
  * these typings.
6
6
  *
7
- * zapier-platform-schema version: 16.4.0
7
+ * zapier-platform-schema version: 16.5.1
8
8
  * schema-to-ts compiler version: 0.1.0
9
9
  */
10
10