netlify-cms-lib-util
Advanced tools
Comparing version
@@ -6,2 +6,13 @@ # Change Log | ||
## [2.12.2](https://github.com/netlify/netlify-cms/tree/master/packages/netlify-cms-lib-util/compare/netlify-cms-lib-util@2.12.1...netlify-cms-lib-util@2.12.2) (2021-02-01) | ||
### Bug Fixes | ||
* **backend:** allow calling 'json' again on 403 failure ([#4880](https://github.com/netlify/netlify-cms/tree/master/packages/netlify-cms-lib-util/issues/4880)) ([1034086](https://github.com/netlify/netlify-cms/tree/master/packages/netlify-cms-lib-util/commit/1034086ff603e28e3a37c8157a74cbc625f658f9)) | ||
## [2.12.1](https://github.com/netlify/netlify-cms/tree/master/packages/netlify-cms-lib-util/compare/netlify-cms-lib-util@2.12.0...netlify-cms-lib-util@2.12.1) (2020-12-13) | ||
@@ -8,0 +19,0 @@ |
@@ -76,13 +76,13 @@ "use strict"; | ||
// GitHub too many requests | ||
const { | ||
message | ||
} = await response.json().catch(() => ({ | ||
const json = await response.json().catch(() => ({ | ||
message: '' | ||
})); | ||
if (message.match('API rate limit exceeded')) { | ||
if (json.message.match('API rate limit exceeded')) { | ||
const now = new Date(); | ||
const nextWindowInSeconds = response.headers.has('X-RateLimit-Reset') ? parseInt(response.headers.get('X-RateLimit-Reset')) : now.getTime() / 1000 + 60; | ||
throw new RateLimitError(message, nextWindowInSeconds); | ||
throw new RateLimitError(json.message, nextWindowInSeconds); | ||
} | ||
response.json = () => Promise.resolve(json); | ||
} | ||
@@ -89,0 +89,0 @@ |
{ | ||
"name": "netlify-cms-lib-util", | ||
"description": "Shared utilities for Netlify CMS.", | ||
"version": "2.12.1", | ||
"version": "2.12.2", | ||
"repository": "https://github.com/netlify/netlify-cms/tree/master/packages/netlify-cms-lib-util", | ||
@@ -28,3 +28,3 @@ "bugs": "https://github.com/netlify/netlify-cms/issues", | ||
}, | ||
"gitHead": "68e676a0ae75cc05d7c773fcd4e8050dc58c84f6" | ||
"gitHead": "d11282ffebfdb4895666fa6cc940b8938226284c" | ||
} |
@@ -60,4 +60,4 @@ import { asyncLock, AsyncLock } from './asyncLock'; | ||
// GitHub too many requests | ||
const { message } = await response.json().catch(() => ({ message: '' })); | ||
if (message.match('API rate limit exceeded')) { | ||
const json = await response.json().catch(() => ({ message: '' })); | ||
if (json.message.match('API rate limit exceeded')) { | ||
const now = new Date(); | ||
@@ -68,4 +68,5 @@ const nextWindowInSeconds = response.headers.has('X-RateLimit-Reset') | ||
throw new RateLimitError(message, nextWindowInSeconds); | ||
throw new RateLimitError(json.message, nextWindowInSeconds); | ||
} | ||
response.json = () => Promise.resolve(json); | ||
} | ||
@@ -72,0 +73,0 @@ return response; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
861380
0.09%