You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice if the REST simulator had support for mocking / doing CORS.
It's easy enough to do it now by registering a HandlerInterceptor, but it would be nice if this kind of thing could be provided out-of-the-box:
public class CorsHandlerInterceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
if (CorsUtils.isCorsRequest(request)) {
response.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "*");
response.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "*");
response.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, "*");
if (CorsUtils.isPreFlightRequest(request)) {
return false;
}
}
return true;
}
}
The text was updated successfully, but these errors were encountered:
It would be nice if the REST simulator had support for mocking / doing CORS.
It's easy enough to do it now by registering a HandlerInterceptor, but it would be nice if this kind of thing could be provided out-of-the-box:
The text was updated successfully, but these errors were encountered: