Skip to content

Commit

Permalink
fix: performing rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Harrison Ifeanyichukwu authored and Harrison Ifeanyichukwu committed Jan 30, 2024
1 parent bbe98a6 commit 8f9117a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 11 additions & 0 deletions src/modules/BodyParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,17 @@ export class BodyParser {
return body;
}

/**
* parse the query parameters in the given url
*/
parseQueryString(url: string): Data {
if (url.indexOf('?') > -1) {
return this.parseUrlEncoded(url.split('?')[1]);
} else {
return {};
}
}

/**
* converts url search parameters to object
* @param searchParams
Expand Down
4 changes: 1 addition & 3 deletions src/modules/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,7 @@ export class Server<
*/
private parseRequestData(request: ServerRequest) {
//parse query
request.query = this.bodyParser.urlSearchParamsToObject(
request.parsedUrl.searchParams
);
request.query = this.bodyParser.parseQueryString(request.url);

//parse the request body
if (request.buffer.length > 0) {
Expand Down

0 comments on commit 8f9117a

Please sign in to comment.