Commit 765a7344 authored by Alexis Tual's avatar Alexis Tual Committed by Daz DeBoer
Browse files

Fix passing expiresInHours query parameter

parent a122cf5a
Loading
Loading
Loading
Loading
+1 −1
Changes for sources/src/develocity/short-lived-token.ts: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ class ShortLivedTokenClient {
    retryInterval = 1000

    async fetchToken(serverUrl: string, accessKey: HostnameAccessKey, expiry: string): Promise<HostnameAccessKey> {
        const queryParams = expiry ? `?expiresInHours${expiry}` : ''
        const queryParams = expiry ? `?expiresInHours=${expiry}` : ''
        const sanitizedServerUrl = !serverUrl.endsWith('/') ? `${serverUrl}/` : serverUrl
        const headers = {
            'Content-Type': 'application/json',
+10
Changes for sources/test/jest/short-lived-token.test.ts: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -114,4 +114,14 @@ describe('short lived tokens', () => {
            .resolves
            .toBeNull()
    })

    it('get short lived token with custom expiry', async () => {
        nock('https://dev')
            .post('/api/auth/token?expiresInHours=4')
            .reply(200, 'token')
        expect.assertions(1)
        await expect(getToken('dev=key1', '4'))
            .resolves
            .toEqual({"keys": [{"hostname": "dev", "key": "token"}]})
    })
})