()
| 138 | } |
| 139 | |
| 140 | toJSON() { |
| 141 | // Opt-in redaction: when the request config carries a `redact` array, the |
| 142 | // value of any matching key (case-insensitive, at any depth) is replaced |
| 143 | // with REDACTED in the serialized snapshot. Undefined or empty leaves the |
| 144 | // existing serialization behavior unchanged. |
| 145 | const config = this.config; |
| 146 | const redactKeys = config && utils.hasOwnProp(config, 'redact') ? config.redact : undefined; |
| 147 | const serializedConfig = |
| 148 | utils.isArray(redactKeys) && redactKeys.length > 0 |
| 149 | ? redactConfig(config, redactKeys) |
| 150 | : utils.toJSONObject(config); |
| 151 | |
| 152 | return { |
| 153 | // Standard |
| 154 | message: this.message, |
| 155 | name: this.name, |
| 156 | // Microsoft |
| 157 | description: this.description, |
| 158 | number: this.number, |
| 159 | // Mozilla |
| 160 | fileName: this.fileName, |
| 161 | lineNumber: this.lineNumber, |
| 162 | columnNumber: this.columnNumber, |
| 163 | stack: this.stack, |
| 164 | // Axios |
| 165 | config: serializedConfig, |
| 166 | code: this.code, |
| 167 | status: this.status, |
| 168 | }; |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated. |
no test coverage detected