Skip to content

Commit 3602a9f

Browse files
Jake ChampionJakeChampion
authored andcommitted
pass the client event to the test route handlers
1 parent edd2ed4 commit 3602a9f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

integration-tests/js-compute/test-harness.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ async function app(event) {
1717
try {
1818
const path = (new URL(event.request.url)).pathname
1919
console.log(`path: ${path}`)
20-
FASTLY_SERVICE_VERSION = env('FASTLY_SERVICE_VERSION')
20+
FASTLY_SERVICE_VERSION = env('FASTLY_SERVICE_VERSION') || 'local'
2121
console.log(`FASTLY_SERVICE_VERSION: ${FASTLY_SERVICE_VERSION}`)
2222
if (routes.has(path)) {
2323
const routeHandler = routes.get(path)
24-
res = await routeHandler()
24+
res = await routeHandler(event)
2525
} else {
2626
res = fail(`${path} endpoint does not exist`)
2727
}
2828
} catch (error) {
2929
res = fail(`The routeHandler threw an error: ${error.message}` + '\n' + error.stack)
3030
} finally {
31-
res.headers.set('FASTLY_SERVICE_VERSION', env('FASTLY_SERVICE_VERSION'));
31+
res.headers.set('fastly_service_version', FASTLY_SERVICE_VERSION);
3232
}
3333
return res;
3434
}

0 commit comments

Comments
 (0)