Skip to content

Commit 15307fb

Browse files
fix(network): trailing data in Network redirect chain
1 parent 49f46b3 commit 15307fb

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/formatters/NetworkFormatter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ function converNetworkRequestDetailedToStringDetailed(
316316
let indent = 0;
317317
for (const request of redirectChain.reverse()) {
318318
response.push(
319-
`${' '.repeat(indent)}${convertNetworkRequestConciseToString(request)})}`,
319+
`${' '.repeat(indent)}${convertNetworkRequestConciseToString(request)}`,
320320
);
321321
indent++;
322322
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
exports[`NetworkFormatter > toStringDetailed > handles redirect chain 1`] = `
2+
## Request http://example.com
3+
Status: pending
4+
### Request Headers
5+
- content-size:10
6+
### Redirect chain
7+
reqid=2 GET http://example.com/redirect [pending]
8+
`;

tests/formatters/NetworkFormatter.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ describe('NetworkFormatter', () => {
291291
assert.match(result, /"response":"body"/);
292292
});
293293

294-
it('handles redirect chain', async () => {
294+
it('handles redirect chain', async (t) => {
295295
const redirectRequest = getMockRequest({
296296
url: 'http://example.com/redirect',
297297
});
@@ -305,8 +305,7 @@ describe('NetworkFormatter', () => {
305305
redactNetworkHeaders: false,
306306
});
307307
const result = formatter.toStringDetailed();
308-
assert.match(result, /Redirect chain/);
309-
assert.match(result, /reqid=2/);
308+
t.assert.snapshot?.(result);
310309
});
311310
it('shows saved to file message in toStringDetailed', async () => {
312311
const request = {

0 commit comments

Comments
 (0)