Skip to content

Commit 75e82e1

Browse files
committed
Fix tests to use GET to bypass CsrfFilter
1 parent 4e61136 commit 75e82e1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

spring-boot-integration-tests/spring-boot-security-tests/spring-boot-security-test-web-helloworld/src/test/java/sample/HelloWebSecurityApplicationTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,15 @@ public void setup() {
5656

5757
@Test
5858
public void requiresAuthentication() throws Exception {
59+
this.request.setMethod("GET");
5960
this.springSecurityFilterChain.doFilter(this.request, this.response, this.chain);
6061
assertThat(this.response.getStatus())
6162
.isEqualTo(HttpServletResponse.SC_UNAUTHORIZED);
6263
}
6364

6465
@Test
6566
public void userAuthenticates() throws Exception {
67+
this.request.setMethod("GET");
6668
this.request.addHeader("Authorization",
6769
"Basic " + new String(Base64.encode("user:password".getBytes("UTF-8"))));
6870

0 commit comments

Comments
 (0)