Skip to content

Commit

Permalink
Fix AK/SK auth for requests with bodies (#91)
Browse files Browse the repository at this point in the history
Fix AK/SK auth for requests with bodies

Fix #84
Acceptance
 PASS  tests/unit/signer.test.ts
 PASS  tests/unit/http.test.ts
 PASS  tests/unit/types.test.ts
 PASS  tests/unit/service.test.ts

Test Suites: 4 passed, 4 total
Tests:       16 passed, 16 total
Snapshots:   0 total
Time:        0.679 s, estimated 1 s
Ran all test suites matching /.\/tests\/unit/i.
 PASS  tests/integration/client.test.ts
  ✓ Client: register service (2 ms)
  ✓ Client: no auth opts (5 ms)
  ✓ Client: abs URL (3 ms)
  ✓ Client: abs URL with base
  ✓ Client: merge handlers (1 ms)
  ✓ Client: ak/sk auth; request headers (8 ms)
  ○ skipped Client: authToken
  ○ skipped Client: authAKSK
  ○ skipped Client: get not registered service
  ○ skipped Client: no ak/sk opts
  ○ skipped Client: ak/sk opts

Test Suites: 1 passed, 1 total
Tests:       5 skipped, 6 passed, 11 total
Snapshots:   0 total
Time:        0.478 s, estimated 1 s
Ran all test suites matching /.\/tests\/integration/i.
 PASS  tests/functional/services/identity.test.ts
 PASS  tests/functional/client.test.ts
 PASS  tests/functional/services/swift.test.ts (6.648 s)
 PASS  tests/functional/services/compute.test.ts (7.827 s)
 PASS  tests/functional/services/image.test.ts (39.113 s)
  ● Console

    console.log
      Loaded 7 pages

      at Pager.<anonymous> (src/oms/services/base.ts:87:17)

    console.log
      Loaded 7 pages

      at Pager.<anonymous> (src/oms/services/base.ts:87:17)

 PASS  tests/functional/services/networkv1.test.ts (51.384 s)

Test Suites: 6 passed, 6 total
Tests:       6 skipped, 36 passed, 42 total
Snapshots:   0 total
Time:        51.647 s
Ran all test suites matching /.\/tests\/functional/i.
coverage files in coverage merged into coverage/merged-coverage.json

Reviewed-by: None <None>
Reviewed-by: Anton Sidelnikov <None>
Reviewed-by: Rodion Gyrbu <[email protected]>
  • Loading branch information
outcatcher authored Jul 9, 2021
1 parent ca6fb19 commit 9a7abf8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/oms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ export class Client {
url: url,
serviceName: '',
headers: config.headers,
})
},
undefined, config.body,
)
if (signedHeaders) {
config.headers.set('X-Sdk-Date', signedHeaders['X-Sdk-Date'])
config.headers.set(this.akskAuthHeader, signedHeaders.Authorization)
Expand Down
5 changes: 3 additions & 2 deletions tests/functional/services/swift.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ jest.setTimeout(30000) // for debug
describe.each(authCases)(
'%s client',
authType => {
const onlyToken = authType !== 'token' ? test.skip : test

let client: Client

Expand All @@ -21,7 +22,7 @@ describe.each(authCases)(
expect(account.domainID).toBe(client.domainID)
})

test('Account: update metadata', async () => {
onlyToken('Account: update metadata', async () => {
const srv = client.getService(SwiftV1)
const testMeta = {
meta: 'data',
Expand Down Expand Up @@ -51,7 +52,7 @@ describe.each(authCases)(
expect(containers).toHaveProperty('length')
})

test('Containers: workflow', async () => {
onlyToken('Containers: workflow', async () => {
const srv = client.getService(SwiftV1)
const name = randomString(10)
await srv.createContainer(name, undefined, { 'container-meta': 'yes' })
Expand Down

0 comments on commit 9a7abf8

Please sign in to comment.