Allow explicitly sending no API version

Closes gh-35566
This commit is contained in:
rstoyanchev
2025-10-08 11:56:53 +01:00
parent 891c3e3a1f
commit 00543becf8
8 changed files with 73 additions and 20 deletions
@@ -248,7 +248,7 @@ class DefaultRestTestClient implements RestTestClient {
}
@Override
public RequestBodySpec apiVersion(Object version) {
public RequestBodySpec apiVersion(@Nullable Object version) {
this.requestHeadersUriSpec.apiVersion(version);
return this;
}
@@ -479,14 +479,19 @@ public interface RestTestClient {
/**
* Set an API version for the request. The version is inserted into the
* request by the {@linkplain Builder#apiVersionInserter(ApiVersionInserter)
* request through the {@link Builder#apiVersionInserter(ApiVersionInserter)
* configured} {@code ApiVersionInserter}.
* @param version the API version of the request; this can be a String or
* some Object that can be formatted by the inserter — for example,
* through an {@link ApiVersionFormatter}
* <p>If no version is set, the
* {@link Builder#defaultApiVersion(Object) defaultApiVersion} is used,
* if configured.
* <p>If {@code null} is passed, then an API version is not inserted
* irrespective of default version settings.
* @param version the API version for the request; this can be a String
* or some Object that can be formatted the inserter, e.g. through an
* {@link ApiVersionFormatter}.
* @return this spec for further declaration of the request
*/
S apiVersion(Object version);
S apiVersion(@Nullable Object version);
/**
* Set the attribute with the given name to the given value.