Skip to content

Commit 4523ca9

Browse files
RobertCraigiestainless-app[bot]
authored andcommitted
fix(bedrock): don't mutate request body inputs
1 parent c128ce7 commit 4523ca9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/bedrock-sdk/src/client.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ export class AnthropicBedrock extends Core.APIClient {
117117
} {
118118
options.__streamClass = Stream;
119119

120+
if (Core.isObj(options.body)) {
121+
// create a shallow copy of the request body so that code that mutates it later
122+
// doesn't mutate the original user-provided object
123+
options.body = { ...options.body };
124+
}
125+
120126
if (Core.isObj(options.body)) {
121127
if (!options.body['anthropic_version']) {
122128
options.body['anthropic_version'] = DEFAULT_VERSION;

0 commit comments

Comments
 (0)