Skip to content

Commit

Permalink
chore: improve codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
gioboa committed Jan 8, 2025
1 parent f6a5159 commit 8616e2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/core/config/resolvers/route-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
NitroRouteConfig,
NitroRouteRules,
} from "nitropack/types";
import { withLeadingSlash } from "ufo";

export async function resolveRouteRulesOptions(options: NitroOptions) {
// Backward compatibility for options.routes
Expand All @@ -19,9 +20,7 @@ export function normalizeRouteRules(
const normalizedRules: Record<string, NitroRouteRules> = {};
for (let path in config.routeRules) {
const routeConfig = config.routeRules[path] as NitroRouteConfig;
if (!path.startsWith("/")) {
path = `/${path}`;
}
path = withLeadingSlash(path);
const routeRules: NitroRouteRules = {
...routeConfig,
redirect: undefined,
Expand Down
1 change: 1 addition & 0 deletions test/fixture/nitro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export default defineNitroConfig({
"/rules/_/cached/noncached": { cache: false, swr: false, isr: false },
"/rules/_/cached/**": { swr: true },
"/api/proxy/**": { proxy: "/api/echo" },
"**": { headers: { "x-test": "test" } },
},
prerender: {
crawlLinks: true,
Expand Down

0 comments on commit 8616e2e

Please sign in to comment.