yaobo 7 rokov pred
rodič
commit
5835544a39

+ 5 - 0
src/main/java/cn/efunbox/audio/aop/AdminInterceptor.java

@@ -7,6 +7,7 @@ import cn.efunbox.audio.utils.HttpUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.data.redis.core.ValueOperations;
+import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.servlet.HandlerInterceptor;
 import org.springframework.web.servlet.ModelAndView;
 
@@ -28,6 +29,10 @@ public class AdminInterceptor implements HandlerInterceptor {
     @Override
     public boolean preHandle(HttpServletRequest request,
                              HttpServletResponse response, Object handler) throws Exception {
+        if(request.getMethod().equalsIgnoreCase("OPTIONS")){
+            HttpUtil.responseOk(request, response);
+            return false;
+        }
         String id = request.getHeader("id");
         String token = request.getHeader("token");
         if(id==null)