-
Notifications
You must be signed in to change notification settings - Fork 5.3k
feat(api): add Request.existingResponse() method #39077
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,11 +59,11 @@ export class RequestDispatcher extends Dispatcher<Request, channels.RequestChann | |
| headers: request.headers(), | ||
| isNavigationRequest: request.isNavigationRequest(), | ||
| redirectedFrom: RequestDispatcher.fromNullable(scope, request.redirectedFrom()), | ||
| hasResponse: !!request._existingResponse(), | ||
| }); | ||
| this._type_Request = true; | ||
| this._browserContextDispatcher = scope; | ||
| this.addObjectListener(Request.Events.Response, () => this._dispatchEvent('response', {})); | ||
| // Push existing response to the client if it exists. | ||
| ResponseDispatcher.fromNullable(scope, request._existingResponse()); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will create a state where for a request with the response on the server side, response-less request will be created on the client.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds like hasResponse is the only way to make it work w/o fixing channels. |
||
| } | ||
|
|
||
| async rawRequestHeaders(params: channels.RequestRawRequestHeadersParams, progress: Progress): Promise<channels.RequestRawRequestHeadersResult> { | ||
|
|
@@ -79,8 +79,8 @@ export class ResponseDispatcher extends Dispatcher<Response, channels.ResponseCh | |
| _type_Response = true; | ||
|
|
||
| static from(scope: BrowserContextDispatcher, response: Response): ResponseDispatcher { | ||
| const result = scope.connection.existingDispatcher<ResponseDispatcher>(response); | ||
| const requestDispatcher = RequestDispatcher.from(scope, response.request()); | ||
| const result = scope.connection.existingDispatcher<ResponseDispatcher>(response); | ||
| return result || new ResponseDispatcher(requestDispatcher, response); | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.