Skip to content

Commit

Permalink
[#132] feat: check method 추가
Browse files Browse the repository at this point in the history
POST를 포함한, 서버 자원 수정 추가 삭제 일때 동작하도록 수정
  • Loading branch information
102092 committed Jun 25, 2020
1 parent a030e8d commit 7fbeb50
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import javax.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

Expand All @@ -24,7 +25,12 @@ public class BasicInterceptor extends HandlerInterceptorAdapter {
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
Object handler) {
log.debug("HTTP : {}", request.getMethod());
if (request.getMethod().equals("POST")) {
if (request.getMethod().equals(HttpMethod.POST.name()) ||
request.getMethod().equals(HttpMethod.PUT.name()) ||
request.getMethod().equals(HttpMethod.DELETE.name()) ||
request.getMethod().equals(HttpMethod.PATCH.name()) ||
request.getMethod().equals(HttpMethod.OPTIONS.name())
) {
Cookie[] cookies = request.getCookies();

if (cookies == null || cookies.length < 1) {
Expand Down

0 comments on commit 7fbeb50

Please sign in to comment.