Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .shiprc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"files": {
".version": []
},
"postbump": "pnpm run docs"
}
2 changes: 1 addition & 1 deletion src/server/auth-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { NextResponse, type NextRequest } from "next/server";
import * as jose from "jose";
import * as oauth from "oauth4webapi";

import { version } from "../../package.json";
import {
AccessTokenError,
AccessTokenErrorCode,
Expand Down Expand Up @@ -154,7 +155,6 @@ export class AuthClient {
const timeout = options.httpTimeout ?? 5000;
if (enableTelemetry) {
const name = "nextjs-auth0";
const version = "4.0.2";

headers.set("User-Agent", `${name}/${version}`);
headers.set(
Expand Down
53 changes: 53 additions & 0 deletions src/utils/pathUtils.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { describe, expect, it } from "vitest";

import {
ensureNoLeadingSlash,
ensureTrailingSlash,
removeTrailingSlash
} from "./pathUtils";

describe("pathUtils", () => {
describe("ensureTrailingSlash", () => {
it("should add a trailing slash if not present", () => {
expect(ensureTrailingSlash("example.com/path")).toBe("example.com/path/");
});

it("should not add a trailing slash if already present", () => {
expect(ensureTrailingSlash("example.com/path/")).toBe(
"example.com/path/"
);
});

it("should return the same string if it is empty", () => {
expect(ensureTrailingSlash("")).toBe("");
});
});

describe("ensureNoLeadingSlash", () => {
it("should remove the leading slash if present", () => {
expect(ensureNoLeadingSlash("/example/path")).toBe("example/path");
});

it("should not remove the leading slash if not present", () => {
expect(ensureNoLeadingSlash("example/path")).toBe("example/path");
});

it("should return the same string if it is empty", () => {
expect(ensureNoLeadingSlash("")).toBe("");
});
});

describe("removeTrailingSlash", () => {
it("should remove the trailing slash if present", () => {
expect(removeTrailingSlash("example.com/path/")).toBe("example.com/path");
});

it("should not remove the trailing slash if not present", () => {
expect(removeTrailingSlash("example.com/path")).toBe("example.com/path");
});

it("should return the same string if it is empty", () => {
expect(removeTrailingSlash("")).toBe("");
});
});
});