Skip to content

Commit 48deb75

Browse files
save file
1 parent bb93a6a commit 48deb75

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

blog/25-07-24/http-server/ex/login-server.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,8 @@
4141

4242
var body = '';
4343
for await(data of req)body+=data;
44-
try{
45-
46-
var json = JSON.parse(body);
47-
48-
}//try
49-
catch(err){
50-
51-
return {};
52-
53-
}//catch
44+
var params = new URLSearchParams(body);
45+
var json = Object.fromEntries(params);
5446
return json;
5547

5648
}//read

0 commit comments

Comments
 (0)