fix: add content-type header for koreader-sync auth (#1016)
* test: add content-type assertion for user auth * fix: specify JSON content type in authorizeUser method Set content type to JSON for user authorization response.
This commit is contained in:
+3
-1
@@ -22,7 +22,9 @@ public class KoreaderController {
|
|||||||
|
|
||||||
@GetMapping("/users/auth")
|
@GetMapping("/users/auth")
|
||||||
public ResponseEntity<Map<String, String>> authorizeUser() {
|
public ResponseEntity<Map<String, String>> authorizeUser() {
|
||||||
return koreaderService.authorizeUser();
|
return koreaderService
|
||||||
|
.authorizeUser()
|
||||||
|
.contentType(MediaType.APPLICATION_JSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/users/create")
|
@PostMapping("/users/create")
|
||||||
|
|||||||
+1
@@ -36,6 +36,7 @@ class KoreaderControllerTest {
|
|||||||
when(koreaderService.authorizeUser()).thenReturn(ResponseEntity.ok(expected));
|
when(koreaderService.authorizeUser()).thenReturn(ResponseEntity.ok(expected));
|
||||||
ResponseEntity<Map<String, String>> resp = controller.authorizeUser();
|
ResponseEntity<Map<String, String>> resp = controller.authorizeUser();
|
||||||
assertEquals(HttpStatus.OK, resp.getStatusCode());
|
assertEquals(HttpStatus.OK, resp.getStatusCode());
|
||||||
|
assertEquals(MediaType.APPLICATION_JSON, resp.getHeaders().getContentType());
|
||||||
assertEquals(expected, resp.getBody());
|
assertEquals(expected, resp.getBody());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user