Make OPTIONS/TRACE request handling configurable
Add properties to WebMvcProperties allowing control of if TRACE/OPTIONS requests should go through the regular dispatching chain. Closes gh-4300
This commit is contained in:
committed by
Phillip Webb
parent
a8b23f9deb
commit
88cf65427f
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -155,10 +155,18 @@ public class DispatcherServletAutoConfigurationTests {
|
||||
DispatcherServletAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.mvc.throw-exception-if-no-handler-found:true");
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.mvc.dispatch-options-request:true");
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.mvc.dispatch-trace-request:true");
|
||||
this.context.refresh();
|
||||
DispatcherServlet bean = this.context.getBean(DispatcherServlet.class);
|
||||
assertEquals(true, new DirectFieldAccessor(bean)
|
||||
.getPropertyValue("throwExceptionIfNoHandlerFound"));
|
||||
assertEquals(true,
|
||||
new DirectFieldAccessor(bean).getPropertyValue("dispatchOptionsRequest"));
|
||||
assertEquals(true,
|
||||
new DirectFieldAccessor(bean).getPropertyValue("dispatchTraceRequest"));
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
Reference in New Issue
Block a user