rubik-pact 1.0.8 → 1.0.9

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.
Files changed (2) hide show
  1. package/classes/Pact.js +3 -2
  2. package/package.json +1 -1
package/classes/Pact.js CHANGED
@@ -12,6 +12,7 @@ const PactError = require('../errors/PactError');
12
12
 
13
13
  const DEFAULT_HOST = 'https://api.pact.im';
14
14
  const DEFAULT_VERSION = 'v8.0';
15
+ const SUCCESS_STATUS_REG = /2\d\d/;
15
16
 
16
17
  /**
17
18
  * Кубик для запросов к API Pact
@@ -85,9 +86,9 @@ class Pact extends Kubik {
85
86
  }
86
87
 
87
88
  const res = await fetch(url, { method, body, headers });
88
- if (res.status !== 200) {
89
+ if (!SUCCESS_STATUS_REG.test(`${res.status}`)) {
89
90
  throw new Error(`Invalid status ${res.status}`);
90
- };
91
+ }
91
92
 
92
93
  const resBody = await res.json();
93
94
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rubik-pact",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Pact Bot Api kubik for the Rubik application system",
5
5
  "main": "classes/Pact.js",
6
6
  "author": "ns@indotech.ru",