Skip to content

Commit bb93a6a

Browse files
save file
1 parent 2ead8a9 commit bb93a6a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,16 @@
4141

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

4756
}//read

0 commit comments

Comments
 (0)