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:
+4
-2
@@ -22,7 +22,9 @@ public class KoreaderController {
|
||||
|
||||
@GetMapping("/users/auth")
|
||||
public ResponseEntity<Map<String, String>> authorizeUser() {
|
||||
return koreaderService.authorizeUser();
|
||||
return koreaderService
|
||||
.authorizeUser()
|
||||
.contentType(MediaType.APPLICATION_JSON);
|
||||
}
|
||||
|
||||
@PostMapping("/users/create")
|
||||
@@ -44,4 +46,4 @@ public class KoreaderController {
|
||||
koreaderService.saveProgress(koreaderProgress.getDocument(), koreaderProgress);
|
||||
return ResponseEntity.ok(Map.of("status", "progress updated"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -36,6 +36,7 @@ class KoreaderControllerTest {
|
||||
when(koreaderService.authorizeUser()).thenReturn(ResponseEntity.ok(expected));
|
||||
ResponseEntity<Map<String, String>> resp = controller.authorizeUser();
|
||||
assertEquals(HttpStatus.OK, resp.getStatusCode());
|
||||
assertEquals(MediaType.APPLICATION_JSON, resp.getHeaders().getContentType());
|
||||
assertEquals(expected, resp.getBody());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user