mirror of
https://github.com/fjogeleit/http-request-action.git
synced 2024-11-21 19:31:00 -05:00
fix retry and ignore status response
Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com>
This commit is contained in:
parent
7c708e96af
commit
bfbe4dd6af
3 changed files with 8 additions and 8 deletions
8
dist/index.js
vendored
8
dist/index.js
vendored
|
@ -27232,7 +27232,7 @@ const retry = async (callback, options) => {
|
|||
lastErr = err;
|
||||
}
|
||||
|
||||
if (i < options.retries) {
|
||||
if (i < options.retry) {
|
||||
options.actions.warning(`#${i + 1} request failed: ${err}`);
|
||||
await sleep(options.sleep);
|
||||
}
|
||||
|
@ -27356,10 +27356,10 @@ const request = async({ method, instanceConfig, data, files, file, actions, opti
|
|||
} catch(error) {
|
||||
if (error.response && options.ignoredCodes.includes(error.response.status)) {
|
||||
actions.warning(`ignored status code: ${JSON.stringify({ code: error.response.status, message: error.response.data })}`)
|
||||
|
||||
return null
|
||||
|
||||
return error.response
|
||||
}
|
||||
|
||||
|
||||
if (!error.response && error.request && options.preventFailureOnNoResponse) {
|
||||
actions.warning(`no response received: ${JSON.stringify(error)}`);
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ const retry = async (callback, options) => {
|
|||
lastErr = err;
|
||||
}
|
||||
|
||||
if (i < options.retries) {
|
||||
if (i < options.retry) {
|
||||
options.actions.warning(`#${i + 1} request failed: ${err}`);
|
||||
await sleep(options.sleep);
|
||||
}
|
||||
|
|
|
@ -94,10 +94,10 @@ const request = async({ method, instanceConfig, data, files, file, actions, opti
|
|||
} catch(error) {
|
||||
if (error.response && options.ignoredCodes.includes(error.response.status)) {
|
||||
actions.warning(`ignored status code: ${JSON.stringify({ code: error.response.status, message: error.response.data })}`)
|
||||
|
||||
return null
|
||||
|
||||
return error.response
|
||||
}
|
||||
|
||||
|
||||
if (!error.response && error.request && options.preventFailureOnNoResponse) {
|
||||
actions.warning(`no response received: ${JSON.stringify(error)}`);
|
||||
|
||||
|
|
Loading…
Reference in a new issue