Skip to content

Commit

Permalink
Merge pull request #49 from kinde-oss/fix/fetch-non-get
Browse files Browse the repository at this point in the history
fix: passing body to non get fetch methods
  • Loading branch information
DaveOrDead authored Feb 25, 2025
2 parents 6d7442f + fe3a1ce commit db56a59
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,12 @@ export async function createKindeAPI(
params,
contentType = "application/json",
}: KindeAPIRequest) => {
let body;

if (params) {
body = method === "GET" ? new URLSearchParams(params) : params;
}

const result = await kinde.fetch(
`${event.context.domains.kindeDomain}/api/v1/${endpoint}`,
{
Expand All @@ -394,7 +400,7 @@ export async function createKindeAPI(
"Content-Type": contentType,
accept: "application/json",
},
body: params && new URLSearchParams(params),
body,
},
);

Expand Down

0 comments on commit db56a59

Please sign in to comment.