Skip to content

Commit

Permalink
fix: [AUTH-2047] disable fetch cache for all requests (#271)
Browse files Browse the repository at this point in the history
* fix: [AUTH-2047] disable fetch cache for all requests

* 9.0.5
  • Loading branch information
max-stytch authored Oct 18, 2023
1 parent f43b1a3 commit 62bc57a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions dist/shared/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export async function request<T>(
response = await fetch(url.toString(), {
method: requestConfig.method,
body: body,
cache: "no-store",
...fetchConfig,
});
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stytch",
"version": "9.0.4",
"version": "9.0.5",
"description": "A wrapper for the Stytch API",
"types": "./types/lib/index.d.ts",
"main": "./dist/index.js",
Expand Down
4 changes: 4 additions & 0 deletions test/shared/shared.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe("request", () => {

expect(fetchMock).toHaveBeenCalledWith("http://localhost:8000/hello", {
method: "GET",
cache: "no-store",
...MOCK_FETCH_CONFIG,
});
});
Expand All @@ -37,6 +38,7 @@ describe("request", () => {
await request(MOCK_FETCH_CONFIG, {
url: "http://localhost:8000/hello",
method: "GET",
cache: "no-store",
params: {
string: "here",
number: 1234,
Expand All @@ -47,6 +49,7 @@ describe("request", () => {

expect(fetchMock).toHaveBeenCalledWith(expectedURL, {
method: "GET",
cache: "no-store",
...MOCK_FETCH_CONFIG,
});
});
Expand All @@ -67,6 +70,7 @@ describe("request", () => {

expect(fetchMock).toHaveBeenCalledWith("http://localhost:8000/hello", {
method: "GET",
cache: "no-store",
body: `{"string":"here","number":1234,"deep":{"array":[123]}}`,
...MOCK_FETCH_CONFIG,
});
Expand Down

0 comments on commit 62bc57a

Please sign in to comment.