Make URI template variables nullable

Closes gh-34221
This commit is contained in:
Sébastien Deleuze
2025-01-10 11:39:21 +01:00
parent bce7d87151
commit ec48c47886
33 changed files with 172 additions and 165 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@@ -216,7 +216,7 @@ final class DefaultWebClient implements WebClient {
}
@Override
public RequestBodySpec uri(String uriTemplate, Object... uriVariables) {
public RequestBodySpec uri(String uriTemplate, @Nullable Object... uriVariables) {
UriBuilder uriBuilder = uriBuilderFactory.uriString(uriTemplate);
attribute(URI_TEMPLATE_ATTRIBUTE, uriBuilder.toUriString());
return uri(uriBuilder.build(uriVariables));

View File

@@ -28,6 +28,7 @@ import java.util.function.Predicate;
import io.micrometer.observation.ObservationConvention;
import io.micrometer.observation.ObservationRegistry;
import org.jspecify.annotations.Nullable;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -391,7 +392,7 @@ public interface WebClient {
* If a {@link UriBuilderFactory} was configured for the client (for example,
* with a base URI) it will be used to expand the URI template.
*/
S uri(String uri, Object... uriVariables);
S uri(String uri, @Nullable Object... uriVariables);
/**
* Specify the URI for the request using a URI template and URI variables.