diff --git a/src/main/java/org/ntlab/nemophila/resources/accounts/AccountPostsRest.java b/src/main/java/org/ntlab/nemophila/resources/accounts/AccountPostsRest.java index 5f259a5..fa51c5a 100644 --- a/src/main/java/org/ntlab/nemophila/resources/accounts/AccountPostsRest.java +++ b/src/main/java/org/ntlab/nemophila/resources/accounts/AccountPostsRest.java @@ -40,9 +40,15 @@ if (account != null && account.getToken().equals(token)) { Post post = account.createPost(shop, rate, genre, comme, img1, img2, img3); return post.getId(); + } else if (!account.getToken().equals(token)){ + var response = Response.status(Response.Status.NO_CONTENT); + response.status(401).entity("tokenの認証に失敗"); + throw new WebApplicationException(response.build()); + } else { + var response = Response.status(Response.Status.NO_CONTENT); + response.status(404).entity("不正なID"); + throw new WebApplicationException(response.build()); } - - return null; } // 「/{uid}/posts」のGETメソッド