MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / startRecordingTraffic

Method startRecordingTraffic

lib/helper/Puppeteer.js:2856–2880  ·  view source on GitHub ↗

* {{> startRecordingTraffic }} *

()

Source from the content-addressed store, hash-verified

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 *

Callers 3

testsFunction · 0.45

Calls 3

flushNetworkTrafficsMethod · 0.95
methodMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected