* {{> startRecordingTraffic }} *
()
| 3860 | * |
| 3861 | */ |
| 3862 | startRecordingTraffic() { |
| 3863 | this.flushNetworkTraffics() |
| 3864 | this.recording = true |
| 3865 | this.recordedAtLeastOnce = true |
| 3866 | |
| 3867 | this.page.on('requestfinished', async request => { |
| 3868 | const information = { |
| 3869 | url: request.url(), |
| 3870 | method: request.method(), |
| 3871 | requestHeaders: request.headers(), |
| 3872 | requestPostData: request.postData(), |
| 3873 | response: request.response(), |
| 3874 | } |
| 3875 | |
| 3876 | this.debugSection('REQUEST: ', JSON.stringify(information)) |
| 3877 | |
| 3878 | if (typeof information.requestPostData === 'object') { |
| 3879 | information.requestPostData = JSON.parse(information.requestPostData) |
| 3880 | } |
| 3881 | |
| 3882 | this.requests.push(information) |
| 3883 | }) |
| 3884 | } |
| 3885 | |
| 3886 | /** |
| 3887 | * Blocks traffic of a given URL or a list of URLs. |
nothing calls this directly
no test coverage detected