/** * Check the HTTP method and determine the methods for the response of a * pre-flight request. The default implementation simply delegates to * {@link org.springframework.web.cors.CorsConfiguration#checkOrigin(String)}. */ @Nullable protected List<HttpMethod> checkMethods(CorsConfiguration config, @Nullable HttpMethod requestMethod) { return config.checkHttpMethod(requestMethod); }
/** * Check the HTTP method and determine the methods for the response of a * pre-flight request. The default implementation simply delegates to * {@link CorsConfiguration#checkOrigin(String)}. */ @Nullable protected List<HttpMethod> checkMethods(CorsConfiguration config, @Nullable HttpMethod requestMethod) { return config.checkHttpMethod(requestMethod); }
/** * Check the HTTP method and determine the methods for the response of a * pre-flight request. The default implementation simply delegates to * {@link CorsConfiguration#checkOrigin(String)}. */ @Nullable protected List<HttpMethod> checkMethods(CorsConfiguration config, @Nullable HttpMethod requestMethod) { return config.checkHttpMethod(requestMethod); }
/** * Check the HTTP method and determine the methods for the response of a * pre-flight request. The default implementation simply delegates to * {@link org.springframework.web.cors.CorsConfiguration#checkOrigin(String)}. */ @Nullable protected List<HttpMethod> checkMethods(CorsConfiguration config, @Nullable HttpMethod requestMethod) { return config.checkHttpMethod(requestMethod); }
@Test public void checkMethodAllowed() { CorsConfiguration config = new CorsConfiguration(); assertEquals(Arrays.asList(HttpMethod.GET, HttpMethod.HEAD), config.checkHttpMethod(HttpMethod.GET)); config.addAllowedMethod("GET"); assertEquals(Arrays.asList(HttpMethod.GET), config.checkHttpMethod(HttpMethod.GET)); config.addAllowedMethod("POST"); assertEquals(Arrays.asList(HttpMethod.GET, HttpMethod.POST), config.checkHttpMethod(HttpMethod.GET)); assertEquals(Arrays.asList(HttpMethod.GET, HttpMethod.POST), config.checkHttpMethod(HttpMethod.POST)); }
@Test public void checkMethodNotAllowed() { CorsConfiguration config = new CorsConfiguration(); assertNull(config.checkHttpMethod(null)); assertNull(config.checkHttpMethod(HttpMethod.DELETE)); config.setAllowedMethods(new ArrayList<>()); assertNull(config.checkHttpMethod(HttpMethod.POST)); }
/** * Check the HTTP method and determine the methods for the response of a * pre-flight request. The default implementation simply delegates to * {@link org.springframework.web.cors.CorsConfiguration#checkOrigin(String)}. */ @Nullable protected List<HttpMethod> checkMethods(CorsConfiguration config, @Nullable HttpMethod requestMethod) { return config.checkHttpMethod(requestMethod); }
/** * Check the HTTP method and determine the methods for the response of a * pre-flight request. The default implementation simply delegates to * {@link CorsConfiguration#checkOrigin(String)}. */ @Nullable protected List<HttpMethod> checkMethods(CorsConfiguration config, @Nullable HttpMethod requestMethod) { return config.checkHttpMethod(requestMethod); }
/** * Check the HTTP method and determine the methods for the response of a * pre-flight request. The default implementation simply delegates to * {@link org.springframework.web.cors.CorsConfiguration#checkOrigin(String)}. */ @Nullable protected List<HttpMethod> checkMethods(CorsConfiguration config, @Nullable HttpMethod requestMethod) { return config.checkHttpMethod(requestMethod); }
/** * Check the HTTP method and determine the methods for the response of a * pre-flight request. The default implementation simply delegates to * {@link CorsConfiguration#checkOrigin(String)}. */ @Nullable protected List<HttpMethod> checkMethods(CorsConfiguration config, @Nullable HttpMethod requestMethod) { return config.checkHttpMethod(requestMethod); }