Skip to content

Commit

Permalink
fix: added trim() to secretValue being sent in PUT request
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobMGEvans committed May 17, 2022
1 parent 963e9e0 commit 0921261
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/grumpy-dolphins-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

fix: added `trim()` to secretValue being sent in PUT request

resolves #993
15 changes: 15 additions & 0 deletions packages/wrangler/src/__tests__/secret.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,21 @@ describe("wrangler secret", () => {
);
}

test("should trim input ", async () => {
mockPrompt({
text: "Enter a secret value:",
type: "password",
result: ` hunter2 `,
});

mockPutRequest({ name: `secret-name`, text: `hunter2` });
await runWrangler("secret put secret-name --name script-name");
expect(std.out).toMatchInlineSnapshot(`
"🌀 Creating the secret for script script-name
✨ Success! Uploaded secret secret-name"
`);
});

describe("interactive", () => {
useMockStdin({ isTTY: true });

Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,7 @@ export async function main(argv: string[]): Promise<void> {
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
name: args.key,
text: secretValue,
text: secretValue.trim(),
type: "secret_text",
}),
});
Expand Down

0 comments on commit 0921261

Please sign in to comment.