Skip to content

Commit

Permalink
fix(server$): return content type changes (#6345)
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickJS committed May 21, 2024
1 parent 0380331 commit f38f153
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/qwik-city/runtime/src/server-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,18 @@ export const serverQrl = <T extends ServerFunction>(
throw obj;
}
return obj;
} else if (contentType === 'application/json') {
const obj = await res.json();
if (res.status === 500) {
throw obj;
}
return obj;
} else if (contentType === 'text/plain' || contentType === 'text/html') {
const str = await res.text();
if (res.status === 500) {
throw str;
}
return str;
}
}
}) as ServerQRL<T>;
Expand Down

0 comments on commit f38f153

Please sign in to comment.