Prechádzať zdrojové kódy

Change Request Parameter Lookup

- For this sample, the expression param.error always has a
value upon querying it
- This isn't the case for the other samples, it may be that in reactive
applications, the request is wrapped in something that always
returns a value
Josh Cummings 1 rok pred
rodič
commit
f795172611

+ 2 - 2
reactive/webflux/java/authentication/username-password/form/src/integTest/java/example/pages/LoginPage.java

@@ -55,12 +55,12 @@ public class LoginPage {
 	}
 
 	public LoginPage assertError() {
-		assertThat(this.alert).extracting(WebElement::getText).contains("Invalid username and password.");
+		assertThat(this.alert).extracting(WebElement::getText).containsOnly("Invalid username and password.");
 		return this;
 	}
 
 	public LoginPage assertLogout() {
-		assertThat(this.alert).extracting(WebElement::getText).contains("You have been logged out.");
+		assertThat(this.alert).extracting(WebElement::getText).containsOnly("You have been logged out.");
 		return this;
 	}
 

+ 2 - 2
reactive/webflux/java/authentication/username-password/form/src/main/resources/templates/login.html

@@ -13,9 +13,9 @@
 <div class="container">
 	<form class="form-signin" method="post" th:action="@{/login}">
 		<h2 class="form-signin-heading">Please Log In</h2>
-		<div th:if="${param.error}" class="alert alert-danger" role="alert">Invalid
+		<div th:if="${param.keySet().contains('error')}" class="alert alert-danger" role="alert">Invalid
 			username and password.</div>
-		<div th:if="${param.logout}" class="alert alert-success" role="alert">You
+		<div th:if="${param.keySet().contains('logout')}" class="alert alert-success" role="alert">You
 			have been logged out.</div>
 		<p>
 			<label for="username" class="sr-only">Username</label>