-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Describe the bug
OkHttpclientImpl
doesn't consider the provided request method for those requests which don't provide a payload body. These requests are all treated as GET
regardless of what the user might have provided through a raw request.
Given the following if-else clause:
Line 377 in e06c2a6
if (body != null) { |
The execution jumps straight to
Lines 412 to 413 in e06c2a6
request.headers().entrySet().stream() | |
.forEach(e -> e.getValue().stream().forEach(v -> requestBuilder.addHeader(e.getKey(), v))); |
since there is no request payload.
The requestBuilder.method
is never set.
Fabric8 Kubernetes Client version
SNAPSHOT
Steps to reproduce
@Test
void postOk() {
// Given
server.expect()
.post()
.withPath("/api/post/ok")
.andReturn(200, "ok")
.once();
// When
final String result = client.raw("/api/post/ok", "POST", null);
// Then
assertThat(result).isEqualTo("ok");
}
Expected behavior
The sent method should be the one provided by the user.
Runtime
Kubernetes (vanilla), OpenShift
Kubernetes API Server version
next (development version)
Environment
Windows, Linux, macOS
Fabric8 Kubernetes Client Logs
No response
Additional context
Might relate to #5422