Skip to content

Commit

Permalink
feat: show debug log on response stage (#506)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **Refactor**
- Enhanced logging for HTTP requests to include detailed response
information, improving debug capabilities.
- **Tests**
- Adjusted logic in the `options.compressed.test.ts` file to handle
Node.js major version comparison more accurately.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
fengmk2 committed Apr 22, 2024
1 parent 49039b6 commit ec18131
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/HttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,8 @@ export class HttpClient extends EventEmitter {
}
}

debug('Request#%d got response, status: %s, headers: %j, timing: %j',
requestId, res.status, res.headers, res.timing);
channels.response.publish({
request: reqMeta,
response: res,
Expand Down
2 changes: 1 addition & 1 deletion test/options.compressed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ describe('options.compressed.test.ts', () => {
// console.error(err);
assert.equal(err.name, 'UnzipError');
assert.equal(err.message, 'Decompression failed');
if (nodeMajorVersion() >= 21) {
if (nodeMajorVersion() >= 20) {
assert.equal(err.code, 'ERR__ERROR_FORMAT_PADDING_1');
} else {
assert.equal(err.code, 'ERR_PADDING_1');
Expand Down

0 comments on commit ec18131

Please sign in to comment.