Skip to content

302 redirected not response body --->throw Can only get response body on requests captured after headers received. #3

Open
@huanshiwushuang

Description

@huanshiwushuang

302 redirect not have response body,throw Error "Can only get response body on requests captured after headers received"
Maybe you need a ---> try catch

try {
    const responseCdp = (await client.send('Fetch.getResponseBody', {
        requestId,
    }));
    const response = {
        body: responseCdp.base64Encoded ? atob_1.default(responseCdp.body) : responseCdp.body,
        headers: event.responseHeaders,
        errorReason: event.responseErrorReason,
        statusCode: event.responseStatusCode,
    };
    newResponse = await this.eventHandlers.onResponseReceived({ response, request });
} catch (e) {
    console.log(e);
    newResponse = await this.eventHandlers.onResponseReceived({ test: 'test' });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions