diff --git a/java-realworld/sample/src/main/java/com/example/demo/controller/fastjsondemo/FastJSONDemoController.java b/java-realworld/sample/src/main/java/com/example/demo/controller/fastjsondemo/FastJSONDemoController.java index e1a4e03..1af8f6c 100644 --- a/java-realworld/sample/src/main/java/com/example/demo/controller/fastjsondemo/FastJSONDemoController.java +++ b/java-realworld/sample/src/main/java/com/example/demo/controller/fastjsondemo/FastJSONDemoController.java @@ -2,19 +2,17 @@ import com.alibaba.fastjson.JSON; import org.apache.ibatis.annotations.Param; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/fastjson") public class FastJSONDemoController { @GetMapping("/fromId") - public String loadFromParam(@RequestParam(name = "id") String id) { + public ResponseEntity loadFromParam(@RequestParam(name = "id") String id) { // This is a FASTJSON Vuln typically. Object anyJSON = JSON.parse(id); - return JSON.toJSONString(anyJSON); + return ResponseEntity.ok(anyJSON); } }