Skip to content

Commit

Permalink
return body
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Gorzala committed Dec 20, 2023
1 parent 760c5ed commit d79e50b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/main/java/net/dancier/dancer/chat/ChatController.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public ResponseEntity<List<ChatDto>> getChats(@CurrentUser AuthenticatedUser aut

@PostMapping("")
@Secured(ROLE_USER)
public ResponseEntity postChat(
public ResponseEntity<CreatedChatDto> postChat(
@CurrentUser AuthenticatedUser authenticatedUser,
@RequestBody CreateChatDto createChatDto) {
log.info("Creating a new chat for User {}.", authenticatedUser.getUserId());
Expand All @@ -59,6 +59,7 @@ public ResponseEntity postChat(
headers.set("Location", location.toString());

return new ResponseEntity(
createdChatDto,
headers,
HttpStatus.CREATED
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void postChatShouldReturnTheChat() throws Exception {
.andExpect(status().isCreated())
.andExpect(header().exists("Location"));

result.andExpect(jsonPath("$").doesNotExist());
result.andExpect(jsonPath("$.id").isNotEmpty());
}

@Test
Expand Down

0 comments on commit d79e50b

Please sign in to comment.