Skip to content

Commit 3ac1567

Browse files
committed
test: add test to reproduce regression
1 parent b4c2dec commit 3ac1567

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

test/server.spec.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,4 +1222,39 @@ test.group('Server | all', (group) => {
12221222
const { body } = await supertest(httpServer).get('/users/1').expect(200)
12231223
assert.deepEqual(body, { matchesRoute: true })
12241224
})
1225+
1226+
/**
1227+
* Reproducing regression
1228+
*/
1229+
test('find if the signed url signature is valid', async (assert) => {
1230+
const app = await setupApp()
1231+
const server = new Server(
1232+
app,
1233+
encryption,
1234+
Object.assign({}, serverConfig, {
1235+
forceContentNegotiationToJSON: true,
1236+
})
1237+
)
1238+
1239+
const httpServer = createServer(server.handle.bind(server))
1240+
server.router
1241+
.get('/users/:id', async ({ request }) => {
1242+
return {
1243+
hasValidSignature: request.hasValidSignature(),
1244+
}
1245+
})
1246+
.as('showUser')
1247+
1248+
server.optimize()
1249+
1250+
/**
1251+
* Make a signed url
1252+
*/
1253+
const url = server.router.makeSignedUrl('showUser', [1], {
1254+
qs: { site: 1, db: 'pg', dbUser: 1 },
1255+
})
1256+
1257+
const { body } = await supertest(httpServer).get(url).expect(200)
1258+
assert.deepEqual(body, { hasValidSignature: true })
1259+
})
12251260
})

0 commit comments

Comments
 (0)