Partially revert RequestPredicates attribute handling

This commit partially reverts 39786e4790
and c5c843696b, as the approach taken did
not take into account request predicates that query request attributes,
including path variables.

Closes gh-31732
This commit is contained in:
Arjen Poutsma
2023-12-04 10:06:28 +01:00
parent aa347e5fe6
commit 52d4b83dba
5 changed files with 499 additions and 366 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2023 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.
@@ -90,7 +90,11 @@ class NestedRouteIntegrationTests extends AbstractRouterFunctionIntegrationTests
restTemplate.getForEntity("http://localhost:" + port + "/1/2/3", String.class);
assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(result.getBody()).isEqualTo("/{foo}/{bar}/{baz}\n{foo=1, bar=2, baz=3}");
String body = result.getBody();
assertThat(body).startsWith("/{foo}/{bar}/{baz}");
assertThat(body).contains("foo=1");
assertThat(body).contains("bar=2");
assertThat(body).contains("baz=3");
}
// SPR-16868

View File

@@ -200,7 +200,7 @@ public class RequestPredicateAttributesTests {
@Override
protected Result testInternal(ServerRequest request) {
return Result.of(this.result, serverRequest -> serverRequest.attributes().put(this.key, this.value));
return Result.of(this.result, attributes -> attributes.put(this.key, this.value));
}
}