@gravity-ui/gateway 4.10.1 → 4.10.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.
@@ -99,7 +99,7 @@ function createRestAction(endpoints, config, serviceKey, actionName, options, Er
99
99
  ? endpointData.axiosConfig
100
100
  : undefined;
101
101
  const actionPath = typeof config.path === 'function'
102
- ? config.path((0, validate_1.getPathArgsProxy)(args, options.encodePathArgs))
102
+ ? config.path((0, validate_1.getPathArgsProxy)(args, options.encodePathArgs, !validationSchema))
103
103
  : config.path;
104
104
  const actionURL = actionEndpoint + actionPath;
105
105
  const parsedActionURL = url_1.default.parse(actionURL);
@@ -1,3 +1,3 @@
1
1
  export declare function validateArgs<TParams>(args: TParams, schema: object): string | false;
2
2
  export declare function getPathParam(value: string): string;
3
- export declare function getPathArgsProxy<TParams extends {}>(args: TParams, encodePathArgs?: boolean): TParams;
3
+ export declare function getPathArgsProxy<TParams extends {}>(args: TParams, encodePathArgs?: boolean, validatePathArgs?: boolean): TParams;
@@ -16,8 +16,7 @@ function getPathParam(value) {
16
16
  return /^((?!(\.\.|\?|#|\\|\/)).)*$/i.test(value) ? value : constants_1.GATEWAY_INVALID_PARAM_VALUE;
17
17
  }
18
18
  exports.getPathParam = getPathParam;
19
- function getPathArgsProxy(args, encodePathArgs) {
20
- const encodePathArgsVal = encodePathArgs !== null && encodePathArgs !== void 0 ? encodePathArgs : true;
19
+ function getPathArgsProxy(args, encodePathArgs = true, validatePathArgs = true) {
21
20
  if (!args) {
22
21
  return args;
23
22
  }
@@ -28,11 +27,11 @@ function getPathArgsProxy(args, encodePathArgs) {
28
27
  return value;
29
28
  }
30
29
  if (typeof value === 'object' && value !== null) {
31
- return getPathArgsProxy(value);
30
+ return getPathArgsProxy(value, encodePathArgs, validatePathArgs);
32
31
  }
33
32
  if (typeof value === 'string') {
34
- const pathParam = getPathParam(value);
35
- if (encodePathArgsVal) {
33
+ const pathParam = validatePathArgs ? getPathParam(value) : value;
34
+ if (encodePathArgs) {
36
35
  try {
37
36
  return encodeURIComponent(pathParam);
38
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/gateway",
3
- "version": "4.10.1",
3
+ "version": "4.10.2",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "main": "build/index.js",