Skip to content

Batch operations throw on HTTP 400 instead of returning per-target results (RSA17c, BAR2, BGF2, RSC24) #2201

@paddybyers

Description

@paddybyers

Spec points

  • RSA17c: `revokeTokens()` should normalise the server response into `{successCount, failureCount, results}`.
  • BAR2, BGF2, RSC24: When the server returns HTTP 400 with `{error, batchResponse}` for mixed or all-failure batch presence results, the SDK should normalise the response into `{successCount, failureCount, results}`.

Observed behaviour

Both `batchPresence()` and `revokeTokens()` use `Resource.get()` / `Resource.post()` with `throwError=true`. Any HTTP 400 response sets `result.err`, which is thrown. The `batchResponse` data containing per-target success/failure results is discarded.

For `revokeTokens()`, the server response body is also passed through as-is rather than normalised.

Failing tests (7)

Test File Issue
`RSA17c_2 - mixed result normalised` `revoke_tokens.test.ts` Throws on HTTP 400 instead of returning results
`RSA17c_3 - all failure normalised` `revoke_tokens.test.ts` Same
`TRF2_1 - failure details in results` `revoke_tokens.test.ts` Same
`BAR2_1 - mixed results normalised` `batch_presence.test.ts` Throws on HTTP 400
`BAR2_3 - all failure normalised` `batch_presence.test.ts` Same
`BGF2_1 - failure result normalised with error details` `batch_presence.test.ts` Same
`RSC24_Mixed_1 - mixed results normalised` `batch_presence.test.ts` Same

Reproduction

```bash
RUN_DEVIATIONS=1 npx mocha --grep "RSA17c_2|RSA17c_3|TRF2_1" test/uts/rest/auth/revoke_tokens.test.ts
RUN_DEVIATIONS=1 npx mocha --grep "BAR2_1|BAR2_3|BGF2_1|RSC24_Mixed" test/uts/rest/batch_presence.test.ts
```

From PR #2191, branch `uts-rest`.

┆Issue is synchronized with this Jira Task by Unito

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working. It's clear that this does need to be fixed.uts-issueIssues raised there there is an apparent discrepancy between this library and the UTS tests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions