File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -19,13 +19,12 @@ async function httpParser(request) {
19
19
req . path = requestLine [ 1 ] ; // e.g., "/path"
20
20
req . version = requestLine [ 2 ] ; // e.g., "HTTP/1.1"
21
21
22
- // Step 3: Handle GET requests (no body expected)
23
- if ( req . method === "GET" ) {
24
- req . query = queryParser ( req . path ) ; // Parse query string for GET requests
25
- return req ; // Return immediately for GET requests
26
- }
22
+ // Step 3: Handle GET requests (expect a query string)
23
+ req . query = queryParser ( req . path ) ; // Parse query string for GET requests
24
+ req . path = req . path . split ( "?" ) [ 0 ] ; // Remove query string from path
25
+
27
26
28
- // Step 4: Handle POST requests (expect a body)
27
+ // Step 4: Handle POST requests (expect a body)
29
28
if ( req . method === "POST" ) {
30
29
// Now we need to parse the body, which is in `bodyPart`
31
30
const position = 0 ; // Start at position 0 of the bodyPart
You can’t perform that action at this time.
0 commit comments