Skip to content

Commit

Permalink
minjor change
Browse files Browse the repository at this point in the history
  • Loading branch information
nybbs2003 committed Oct 18, 2023
1 parent d13b3a6 commit 2e86d8b
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.net.URL;

import org.json.JSONObject;

import com.jfinal.core.Controller;
import com.jfinal.core.Path;

Expand All @@ -18,7 +20,7 @@ public void index() {
renderJson(MyDb.list_server_url());
break;
case "POST":
String line = getRawData();
var line = getRawData();
try {
new URL(line);
} catch (Exception e) {
Expand All @@ -30,7 +32,8 @@ public void index() {
break;
case "PUT":
renderText("");
getResponse().setStatus(MyDb.update_server_url(getParaToInt("id"), getPara("url")) ? 201 : 400);
var jobj = new JSONObject(getRawData());
getResponse().setStatus(MyDb.update_server_url(jobj.getInt("id"), jobj.getString("url")) ? 201 : 400);
break;
case "DELETE":
renderText("");
Expand Down

0 comments on commit 2e86d8b

Please sign in to comment.