springboot--ResponseEntity修改返回的 请求头 和 响应码 和 响应体的方法

@RequestMapping("/hello")
public ResponseEntity<String> hello() {
    HttpHeaders headers = new HttpHeaders();
    headers.set("yyyy","111111");
    headers.set("uuuuu","22222");
    return ResponseEntity.status(202).headers(headers)
            .body("Custom header set");
}
posted @ 2022-03-17 17:20  凯宾斯基  阅读(1965)  评论(0)    收藏  举报