mirror of
https://github.com/gradle/actions
synced 2024-11-23 18:02:13 +00:00
Fix passing expiresInHours query parameter
This commit is contained in:
parent
a122cf5aa7
commit
765a73447c
2 changed files with 11 additions and 1 deletions
|
@ -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',
|
||||
|
|
|
@ -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"}]})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue