mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-05-11 19:04:20 +00:00
node_modules
This commit is contained in:
parent
0e414c630a
commit
78c309ef59
555 changed files with 103819 additions and 1 deletions
28
node_modules/@octokit/plugin-throttling/test/integration/octokit.js
generated
vendored
Normal file
28
node_modules/@octokit/plugin-throttling/test/integration/octokit.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
const Octokit = require('@octokit/rest')
|
||||
const HttpError = require('@octokit/request/lib/http-error')
|
||||
const throttlingPlugin = require('../..')
|
||||
|
||||
module.exports = Octokit
|
||||
.plugin((octokit) => {
|
||||
octokit.__t0 = Date.now()
|
||||
octokit.__requestLog = []
|
||||
octokit.__requestTimings = []
|
||||
|
||||
octokit.hook.wrap('request', async (request, options) => {
|
||||
octokit.__requestLog.push(`START ${options.method} ${options.url}`)
|
||||
octokit.__requestTimings.push(Date.now() - octokit.__t0)
|
||||
await new Promise(resolve => setTimeout(resolve, 0))
|
||||
|
||||
const res = options.request.responses.shift()
|
||||
if (res.status >= 400) {
|
||||
const message = res.data.message != null ? res.data.message : `Test failed request (${res.status})`
|
||||
const error = new HttpError(message, res.status, res.headers, options)
|
||||
throw error
|
||||
} else {
|
||||
octokit.__requestLog.push(`END ${options.method} ${options.url}`)
|
||||
octokit.__requestTimings.push(Date.now() - octokit.__t0)
|
||||
return res
|
||||
}
|
||||
})
|
||||
})
|
||||
.plugin(throttlingPlugin)
|
Loading…
Add table
Add a link
Reference in a new issue