Skip to content

Commit 12382b0

Browse files
Copilotkobenguyent
andcommitted
Changes before error encountered
Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>
1 parent 68a1bcd commit 12382b0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/helper/REST.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,9 @@ class REST extends Helper {
218218
}
219219
}
220220

221-
if (this.options.onRequest) {
222-
await this.options.onRequest(request)
221+
const onRequest = this.options.onRequest || this.config.onRequest
222+
if (onRequest) {
223+
await onRequest(request)
223224
}
224225

225226
try {
@@ -248,8 +249,9 @@ class REST extends Helper {
248249
}
249250
response = err.response
250251
}
251-
if (this.options.onResponse) {
252-
await this.options.onResponse(response)
252+
const onResponse = this.options.onResponse || this.config.onResponse
253+
if (onResponse) {
254+
await onResponse(response)
253255
}
254256
try {
255257
this.options.prettyPrintJson ? this.debugSection('Response', beautify(JSON.stringify(response.data))) : this.debugSection('Response', JSON.stringify(response.data))

0 commit comments

Comments
 (0)