* {{> startRecordingTraffic }} *
()
| 2854 | * |
| 2855 | */ |
| 2856 | async startRecordingTraffic() { |
| 2857 | this.flushNetworkTraffics() |
| 2858 | this.recording = true |
| 2859 | this.recordedAtLeastOnce = true |
| 2860 | |
| 2861 | await this.page.setRequestInterception(true) |
| 2862 | |
| 2863 | this.page.on('request', request => { |
| 2864 | const information = { |
| 2865 | url: request.url(), |
| 2866 | method: request.method(), |
| 2867 | requestHeaders: request.headers(), |
| 2868 | requestPostData: request.postData(), |
| 2869 | response: request.response(), |
| 2870 | } |
| 2871 | |
| 2872 | this.debugSection('REQUEST: ', JSON.stringify(information)) |
| 2873 | |
| 2874 | if (typeof information.requestPostData === 'object') { |
| 2875 | information.requestPostData = JSON.parse(information.requestPostData) |
| 2876 | } |
| 2877 | request.continue() |
| 2878 | this.requests.push(information) |
| 2879 | }) |
| 2880 | } |
| 2881 | |
| 2882 | /** |
| 2883 | * |
no test coverage detected