Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow server-only load functions to return more than JSON #6318

Merged
merged 25 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix
  • Loading branch information
Rich-Harris committed Aug 26, 2022
commit 859f4cbd0d3028f482e782f160b68ce44a6ddb8e
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function respond(request, options, state) {
}
}

if (route?.page) {
if (route?.page && !is_data_request) {
const normalized = normalize_path(url.pathname, options.trailing_slash);

if (normalized !== url.pathname && !state.prerendering?.fallback) {
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/test/prerendering/basics/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test('renders a server-side redirect', () => {

const code = read('redirect-server/__data.js');
const window = {};
new Function('window', `(${code})`)(window);
new Function('window', code)(window);

assert.equal(window.__sveltekit_data, {
type: 'redirect',
Expand Down