Skip to content

Commit

Permalink
fix: query info in fc (#6572)
Browse files Browse the repository at this point in the history
* fix: compatible with query parsing errors caused by ctx.req.url  error in the fc environment

* chore: add changelog
  • Loading branch information
chenjun1011 authored Oct 11, 2023
1 parent aa29b37 commit df85410
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/famous-pigs-pretend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ice/runtime': patch
---

fix: compatible with query parsing errors caused by ctx.req.url error in the fc environment
4 changes: 3 additions & 1 deletion packages/runtime/src/requestContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export interface Location {
*/
export default function getRequestContext(location: Location, serverContext: ServerContext = {}): RequestContext {
const { pathname, search } = location;
const query = parseSearch(search);
// Use query form server context first to avoid unnecessary parsing.
// @ts-ignore
const query = serverContext?.req?.query || parseSearch(search);

const requestContext: RequestContext = {
...(serverContext || {}),
Expand Down

0 comments on commit df85410

Please sign in to comment.