svix 1.96.0 → 1.96.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/request.d.ts +1 -1
- package/dist/request.js +1 -1
- package/package.json +1 -1
- package/src/mockttp.test.ts +21 -0
- package/src/request.ts +1 -1
package/dist/request.d.ts
CHANGED
package/dist/request.js
CHANGED
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SvixRequest = exports.HttpMethod = exports.LIB_VERSION = void 0;
|
|
13
13
|
const util_1 = require("./util");
|
|
14
|
-
exports.LIB_VERSION = "1.96.
|
|
14
|
+
exports.LIB_VERSION = "1.96.1";
|
|
15
15
|
function getUserAgent() {
|
|
16
16
|
var fields = [`svix-libs/${exports.LIB_VERSION}/javascript`];
|
|
17
17
|
if (process !== undefined) {
|
package/package.json
CHANGED
package/src/mockttp.test.ts
CHANGED
|
@@ -470,6 +470,27 @@ test("mockttp tests", async (t) => {
|
|
|
470
470
|
assert(idempotencyKey.startsWith("auto_"));
|
|
471
471
|
});
|
|
472
472
|
|
|
473
|
+
await t.test("POST retry reuses the same auto idempotency key", async () => {
|
|
474
|
+
const endpointMock = await mockServer
|
|
475
|
+
.forPost("/api/v1/app")
|
|
476
|
+
.thenReply(500, `{"code":"500","detail":"asd"}`);
|
|
477
|
+
const svx = new Svix("token", {
|
|
478
|
+
serverUrl: mockServer.url,
|
|
479
|
+
numRetries: 2,
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
await assert.rejects(svx.application.create({ name: "test app" }), ApiException);
|
|
483
|
+
|
|
484
|
+
const requests = await endpointMock.getSeenRequests();
|
|
485
|
+
assert.equal(requests.length, 3);
|
|
486
|
+
|
|
487
|
+
const idempotencyKey = requests[0].headers["idempotency-key"] as string;
|
|
488
|
+
assert(idempotencyKey.startsWith("auto_"));
|
|
489
|
+
|
|
490
|
+
for (const request of requests) {
|
|
491
|
+
assert.equal(request.headers["idempotency-key"], idempotencyKey);
|
|
492
|
+
}
|
|
493
|
+
});
|
|
473
494
|
await t.test("test client provided idempotency key is not overridden", async () => {
|
|
474
495
|
const endpointMock = await mockServer
|
|
475
496
|
.forPost("/api/v1/app")
|
package/src/request.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ApiException, type XOR } from "./util";
|
|
2
2
|
import type { HttpErrorOut, HTTPValidationError } from "./HttpErrors";
|
|
3
3
|
|
|
4
|
-
export const LIB_VERSION = "1.96.
|
|
4
|
+
export const LIB_VERSION = "1.96.1";
|
|
5
5
|
|
|
6
6
|
function getUserAgent() {
|
|
7
7
|
var fields = [`svix-libs/${LIB_VERSION}/javascript`];
|