@better-auth/core 1.5.4 → 1.5.5
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/context/global.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-metadata.mjs","names":[],"sources":["../../src/utils/fetch-metadata.ts"],"sourcesContent":["export function isBrowserFetchRequest(headers?: Headers | null): boolean {\n\treturn headers?.get(\"sec-fetch-mode\") === \"cors\";\n}\n"],"mappings":";AAAA,SAAgB,sBAAsB,SAAmC;AACxE,QAAO,SAAS,IAAI,iBAAiB,KAAK"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { isBrowserFetchRequest } from "./fetch-metadata";
|
|
3
|
+
|
|
4
|
+
describe("isBrowserFetchRequest", () => {
|
|
5
|
+
it("returns true for browser fetch requests", () => {
|
|
6
|
+
expect(
|
|
7
|
+
isBrowserFetchRequest(
|
|
8
|
+
new Headers({
|
|
9
|
+
"Sec-Fetch-Mode": "cors",
|
|
10
|
+
}),
|
|
11
|
+
),
|
|
12
|
+
).toBe(true);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it("returns false for navigation requests", () => {
|
|
16
|
+
expect(
|
|
17
|
+
isBrowserFetchRequest(
|
|
18
|
+
new Headers({
|
|
19
|
+
"Sec-Fetch-Mode": "navigate",
|
|
20
|
+
}),
|
|
21
|
+
),
|
|
22
|
+
).toBe(false);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("returns false without fetch metadata", () => {
|
|
26
|
+
expect(isBrowserFetchRequest()).toBe(false);
|
|
27
|
+
});
|
|
28
|
+
});
|