Skip to content

Commit

Permalink
[bugfix] Only POST and PUT methods carry payload (apache#2302)
Browse files Browse the repository at this point in the history
Co-authored-by: tomsun28 <[email protected]>
  • Loading branch information
pwallk and tomsun28 authored Jul 19, 2024
1 parent 55b3dd7 commit 70af066
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ public HttpUriRequest createHttpRequest(HttpProtocol httpProtocol) {
}

// if it has payload, would override post params
if (StringUtils.hasLength(httpProtocol.getPayload())) {
if (StringUtils.hasLength(httpProtocol.getPayload()) && (HttpMethod.POST.matches(httpMethod) || HttpMethod.PUT.matches(httpMethod))) {
requestBuilder.setEntity(new StringEntity(httpProtocol.getPayload(), StandardCharsets.UTF_8));
}

Expand Down

0 comments on commit 70af066

Please sign in to comment.