Skip to content

Conversation

@kuhe
Copy link
Contributor

@kuhe kuhe commented Jul 2, 2024

https://smithy.io/2.0/spec/behavior-traits.html#idempotencytoken-trait

Client implementations MAY automatically provide a value for a request token member if and only if the member is not explicitly provided.

This adds the automatic default token for headers. Previously added for query params in aws/aws-sdk-js-v3#4272.

before

const headers: any = map({}, isSerializableHeaderValue, {
  "content-type": "application/json",
  [_xact]: input[_CT]!,
});

after

import { v4 as generateIdempotencyToken } from "uuid";

const headers: any = map({}, isSerializableHeaderValue, {
  "content-type": "application/json",
  [_xact]: input[_CT] ?? generateIdempotencyToken(),
});

@kuhe kuhe requested review from a team as code owners July 2, 2024 19:07
@kuhe kuhe requested a review from syall July 2, 2024 19:07
@kuhe kuhe force-pushed the feat/idempotencyTokenHeader branch 4 times, most recently from 4da1bb1 to 45d93f4 Compare July 2, 2024 19:29
@kuhe kuhe force-pushed the feat/idempotencyTokenHeader branch from 45d93f4 to fc7e388 Compare July 2, 2024 19:37
@kuhe kuhe requested review from milesziemer and removed request for syall July 2, 2024 19:43
@kuhe kuhe merged commit 759bf43 into smithy-lang:main Jul 3, 2024
@kuhe kuhe deleted the feat/idempotencyTokenHeader branch July 3, 2024 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants