Skip to content

Commit 7a255d3

Browse files
committed
[chore] remove InternalHandle
1 parent 95c47bc commit 7a255d3

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

.changeset/tender-buses-talk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': patch
3+
---
4+
5+
[chore] remove InternalHandle

packages/kit/src/runtime/server/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ export async function respond(request, options, state = {}) {
122122
let decoded = decodeURI(event.url.pathname);
123123

124124
if (options.paths.base) {
125-
if (!decoded.startsWith(options.paths.base)) return;
125+
if (!decoded.startsWith(options.paths.base)) {
126+
return new Response(undefined, { status: 404 });
127+
}
126128
decoded = decoded.slice(options.paths.base.length) || '/';
127129
}
128130

@@ -187,6 +189,8 @@ export async function respond(request, options, state = {}) {
187189
ssr
188190
});
189191
}
192+
193+
return new Response(undefined, { status: 404 });
190194
},
191195

192196
// TODO remove for 1.0

packages/kit/types/hooks.d.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,6 @@ export interface Handle<Locals = Record<string, any>> {
2424
}): MaybePromise<Response>;
2525
}
2626

27-
// internally, `resolve` could return `undefined`, so we differentiate InternalHandle
28-
// from the public Handle type
29-
export interface InternalHandle<Locals = Record<string, any>> {
30-
(input: {
31-
event: RequestEvent<Locals>;
32-
resolve(event: RequestEvent<Locals>, opts?: ResolveOpts): MaybePromise<Response | undefined>;
33-
}): MaybePromise<Response | undefined>;
34-
}
35-
3627
export interface HandleError<Locals = Record<string, any>> {
3728
(input: { error: Error & { frame?: string }; event: RequestEvent<Locals> }): void;
3829
}

packages/kit/types/internal.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { OutputAsset, OutputChunk } from 'rollup';
22
import { InternalApp, SSRManifest } from './app';
33
import { Fallthrough, RequestHandler } from './endpoint';
44
import { Either } from './helper';
5-
import { ExternalFetch, GetSession, HandleError, InternalHandle, RequestEvent } from './hooks';
5+
import { ExternalFetch, GetSession, Handle, HandleError, RequestEvent } from './hooks';
66
import { Load } from './page';
77

88
export interface PrerenderOptions {
@@ -97,7 +97,7 @@ export type SSRNodeLoader = () => Promise<SSRNode>;
9797
export interface Hooks {
9898
externalFetch: ExternalFetch;
9999
getSession: GetSession;
100-
handle: InternalHandle;
100+
handle: Handle;
101101
handleError: HandleError;
102102
}
103103

0 commit comments

Comments
 (0)