header 를 이용한 api 버전관리
This commit is contained in:
@@ -33,7 +33,9 @@ public class AdminController {
|
||||
|
||||
// GET /admin/user/1 -> version 추가
|
||||
// @GetMapping("/v1/users/{id}")
|
||||
@GetMapping(value = "/users/{id}/", params = "version=1")
|
||||
// @GetMapping(value = "/users/{id}/", params = "version=1")
|
||||
// @GetMapping(value = "/users/{id}", headers = "X-API-VERSION=1")
|
||||
@GetMapping(value = "/users/{id}", produces = "application/vnd.company.appv1+json")
|
||||
public MappingJacksonValue retrieveUserV1(@PathVariable int id) {
|
||||
User user = userDaoService.findOne(id);
|
||||
|
||||
@@ -51,7 +53,9 @@ public class AdminController {
|
||||
return mapping;
|
||||
}
|
||||
// @GetMapping("/v2/users/{id}")
|
||||
@GetMapping(value = "/users/{id}/", params = "version=2")
|
||||
// @GetMapping(value = "/users/{id}/", params = "version=2")
|
||||
// @GetMapping(value = "/users/{id}", headers = "X-API-VERSION=2")
|
||||
@GetMapping(value = "/users/{id}", produces = "application/vnd.company.appv2+json")
|
||||
public MappingJacksonValue retrieveUserV2(@PathVariable int id) {
|
||||
User user = userDaoService.findOne(id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user