MCPcopy
hub / github.com/mswjs/msw / beforeNavigation

Function beforeNavigation

test/browser/msw-api/integrity-check.test.ts:52–67  ·  view source on GitHub ↗
(compilation)

Source from the content-addressed store, hash-verified

50 {
51 skipActivation: true,
52 beforeNavigation(compilation) {
53 compilation.use((router) => {
54 router.use('/', (_, res, next) => {
55 // Appended router are relative to the compilation path.
56 // Allow the nested worker script to control the root scope.
57 res.setHeader('Service-Worker-Allowed', '/')
58 next()
59 })
60
61 router.get('/mockServiceWorker-outdated.js', (_, res) => {
62 return res
63 .set('content-type', 'application/javascript')
64 .send(fs.readFileSync(TEMP_SERVICE_WORKER_PATH, 'utf8'))
65 })
66 })
67 },
68 },
69 )
70

Callers

nothing calls this directly

Calls 3

nextFunction · 0.85
useMethod · 0.80
sendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…