zapier-platform-core 9.7.1 → 9.7.2

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": "9.7.1",
3
+ "version": "9.7.2",
4
4
  "description": "The core SDK for CLI apps in the Zapier Developer Platform.",
5
5
  "repository": "zapier/zapier-platform-core",
6
6
  "homepage": "https://zapier.com/",
@@ -47,7 +47,7 @@
47
47
  "node-fetch": "2.6.7",
48
48
  "oauth-sign": "0.9.0",
49
49
  "semver": "5.6.0",
50
- "zapier-platform-schema": "9.7.1"
50
+ "zapier-platform-schema": "9.7.2"
51
51
  },
52
52
  "devDependencies": {
53
53
  "adm-zip": "0.4.13",
@@ -8,13 +8,30 @@ const hasQueryParams = ({ params = {} }) => Object.keys(params).length;
8
8
  // Take params off of req.params and append to url - "?a=1&b=2"".
9
9
  // This middleware should run *after* custom middlewares, because
10
10
  // custom middlewares might add params.
11
- const addQueryParams = req => {
11
+ const addQueryParams = (req) => {
12
12
  if (hasQueryParams(req)) {
13
13
  const splitter = req.url.includes('?') ? '&' : '?';
14
14
 
15
15
  normalizeEmptyParamFields(req);
16
16
 
17
- const stringifiedParams = querystring.stringify(req.params);
17
+ let stringifiedParams = querystring.stringify(req.params);
18
+
19
+ // it goes against spec, but for compatibility, some APIs want certain
20
+ // characters (mostly $) unencoded
21
+ if (req.skipEncodingChars) {
22
+ for (let i = 0; i < req.skipEncodingChars.length; i++) {
23
+ const char = req.skipEncodingChars.charAt(i);
24
+ const valToReplace = querystring.escape(char);
25
+ if (valToReplace === char) {
26
+ continue;
27
+ }
28
+ // no replaceAll in JS yet, coming in a node version soon!
29
+ stringifiedParams = stringifiedParams.replace(
30
+ new RegExp(valToReplace, 'g'),
31
+ char
32
+ );
33
+ }
34
+ }
18
35
 
19
36
  if (stringifiedParams) {
20
37
  req.url += `${splitter}${stringifiedParams}`;