Skip to content

Commit

Permalink
fix(next): Avoid appending ? if querystring is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
blaine-arcjet committed Dec 14, 2023
1 parent 5a35169 commit 5e455f7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions arcjet-next/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,12 @@ export default function arcjetNext<const Rules extends (Primitive | Product)[]>(
const method = request.method ?? "";
const host = headers.get("host") ?? "";
let path;
// TODO(#224): nextUrl has formatting logic when you `toString` but we don't account for that here
// TODO(#36): nextUrl has formatting logic when you `toString` but we don't account for that here
if (typeof request.nextUrl !== "undefined") {
path = request.nextUrl.pathname + "?" + request.nextUrl.search;
path = request.nextUrl.pathname;
if (request.nextUrl.search !== "") {
path += "?" + request.nextUrl.search;
}
} else {
path = request.url ?? "";
}
Expand Down

0 comments on commit 5e455f7

Please sign in to comment.