springmvc 获取请求头信息
2021-07-01 08:06
标签:code void test request out lse 信息 mapping ams springmvc 获取请求头信息 标签:code void test request out lse 信息 mapping ams 原文地址:https://www.cnblogs.com/huanggy/p/9637771.html@PostMapping("/test/post")
public void post(@RequestBody String params,
@RequestHeader(required = false, value = "contentType") String contentType,
@RequestHeader(required = false, value = "Accept") String Accept) {
System.out.println("contentType:" + contentType);
System.out.println("Accept:" + Accept);
JSONObject json = JSONObject.parseObject(params);
String userName = json.getString("username");
System.out.println("userName:" + userName);
}