Skip to content

Commit

Permalink
feat: network request: prioritize response status code over extraInfo
Browse files Browse the repository at this point in the history
Bug: #644
  • Loading branch information
Thiago Perrotta committed Oct 23, 2023
1 parent c03051c commit dd2a229
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/bidiMapper/domains/network/NetworkRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ export class NetworkRequest {
/** Returns the HTTP status code associated with this request if any. */
get statusCode(): number {
return (
this.#response.extraInfo?.statusCode ??
this.#response.info?.response.status ??
this.#response.extraInfo?.statusCode ??
200 // TODO: Throw an exception or use some other status code?
);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/network/test_continue_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ async def test_continue_response_completes_use_cdp_events(
},
}, ],
"url": example_url,
"status": 200, # TODO: Update status code to 501?
"status": 501,
"statusText": "Remember to drink water",
}),
"timestamp": ANY_TIMESTAMP,
Expand Down Expand Up @@ -413,7 +413,7 @@ async def test_continue_response_completes_use_bidi_events(
},
}, ],
"url": example_url,
"status": 200, # TODO: Update status code to 501?
"status": 501,
"statusText": "Remember to drink water",
}),
"timestamp": ANY_TIMESTAMP,
Expand Down
4 changes: 2 additions & 2 deletions tests/network/test_provide_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ async def test_provide_response_completes_use_cdp_events(
},
}, ],
"url": example_url,
"status": 200, # TODO: Update status code to 501?
"status": 501,
"statusText": "Remember to drink water",
}),
"timestamp": ANY_TIMESTAMP,
Expand Down Expand Up @@ -379,7 +379,7 @@ async def test_provide_response_completes_use_bidi_events(
},
}, ],
"url": example_url,
"status": 200, # TODO: Update status code to 501?
"status": 501,
"statusText": "Remember to drink water",
}),
"timestamp": ANY_TIMESTAMP,
Expand Down

0 comments on commit dd2a229

Please sign in to comment.