(1)
@PostMapping("/test3")
public String p2(@RequestParam PostRequestDto requestDto) {
System.out.println(requestDto.toString());
return "";
}
(2)
@PostMapping("/test")
public String p(PostRequestDto requestDto) {
System.out.println(requestDto.toString());
return "";
}
application/x-www-form-urlencoded 타입 헤더에 dto로 받을 때
(1)은 못 들어오고 (2)는 잡힌다. (Dto는 setter있어야 잡힌다.)
dto아니면 (1)도 잡고 (2)도 잡는다.
public class UserSignUpDto {
private String username;
private String password;
private String email;
private boolean admin = false;
private String adminToken = "";
}
boolean type은 true, True, tRUE 등 text만 맞게 보내면 된다.
@PostMapping("/test2")
public String g2(@RequestBody PostRequestDto requestDto) {
System.out.println(requestDto.toString());
return "";
}
body의 경우 사용해야 잡힌다.
RequestParam이 잡는게 뭐지? (일단 쓰지 말자)