Server transports: remove deprecated methods from builder
Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>
This commit is contained in:
parent
301dbe46ce
commit
8c7774ad5f
1 changed files with 0 additions and 96 deletions
|
|
@ -333,66 +333,6 @@ class HttpClientSseClientTransportTests {
|
|||
customizedTransport.closeGracefully().block();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCustomizeRequest() {
|
||||
// Create an atomic boolean to verify the customizer was called
|
||||
AtomicBoolean customizerCalled = new AtomicBoolean(false);
|
||||
|
||||
// Create a reference to store the custom header value
|
||||
AtomicReference<String> headerName = new AtomicReference<>();
|
||||
AtomicReference<String> headerValue = new AtomicReference<>();
|
||||
|
||||
// Create a transport with the customizer
|
||||
HttpClientSseClientTransport customizedTransport = HttpClientSseClientTransport.builder(host)
|
||||
// Create a request customizer that adds a custom header
|
||||
.customizeRequest(builder -> {
|
||||
builder.header("X-Custom-Header", "test-value");
|
||||
customizerCalled.set(true);
|
||||
|
||||
// Create a new request to verify the header was set
|
||||
HttpRequest request = builder.uri(URI.create("http://example.com")).build();
|
||||
headerName.set("X-Custom-Header");
|
||||
headerValue.set(request.headers().firstValue("X-Custom-Header").orElse(null));
|
||||
})
|
||||
.build();
|
||||
|
||||
// Verify the customizer was called
|
||||
assertThat(customizerCalled.get()).isTrue();
|
||||
|
||||
// Verify the header was set correctly
|
||||
assertThat(headerName.get()).isEqualTo("X-Custom-Header");
|
||||
assertThat(headerValue.get()).isEqualTo("test-value");
|
||||
|
||||
// Clean up
|
||||
customizedTransport.closeGracefully().block();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testChainedCustomizations() {
|
||||
// Create atomic booleans to verify both customizers were called
|
||||
AtomicBoolean clientCustomizerCalled = new AtomicBoolean(false);
|
||||
AtomicBoolean requestCustomizerCalled = new AtomicBoolean(false);
|
||||
|
||||
// Create a transport with both customizers chained
|
||||
HttpClientSseClientTransport customizedTransport = HttpClientSseClientTransport.builder(host)
|
||||
.customizeClient(builder -> {
|
||||
builder.connectTimeout(Duration.ofSeconds(30));
|
||||
clientCustomizerCalled.set(true);
|
||||
})
|
||||
.customizeRequest(builder -> {
|
||||
builder.header("X-Api-Key", "test-api-key");
|
||||
requestCustomizerCalled.set(true);
|
||||
})
|
||||
.build();
|
||||
|
||||
// Verify both customizers were called
|
||||
assertThat(clientCustomizerCalled.get()).isTrue();
|
||||
assertThat(requestCustomizerCalled.get()).isTrue();
|
||||
|
||||
// Clean up
|
||||
customizedTransport.closeGracefully().block();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRequestCustomizer() {
|
||||
var mockCustomizer = mock(McpSyncHttpClientRequestCustomizer.class);
|
||||
|
|
|
|||
Loading…
Reference in a new issue