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

Method startRecordingTraffic

lib/helper/Playwright.js:3862–3884  ·  view source on GitHub ↗

* {{> startRecordingTraffic }} *

()

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 3

flushNetworkTrafficsMethod · 0.95
methodMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected