From 78282c123d161b0aa1496f3eb6d4a847d0c85915 Mon Sep 17 00:00:00 2001 From: Niko Dziemba Date: Wed, 8 Jun 2022 14:25:22 +0200 Subject: [PATCH] Use correct HTTP method for redirects Instead of hardcoding POST, let's use the original method when following redirects. This fixes deleting commit comments (and other calls potentially). We'll add tests for this in a follow-up since it requires a non-trivial amount of setup to test properly and we need to ship this fix ASAP. Sorry. --- src/main/java/com/spotify/github/v3/clients/GitHubClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/spotify/github/v3/clients/GitHubClient.java b/src/main/java/com/spotify/github/v3/clients/GitHubClient.java index 0294ae88..e58e5e68 100644 --- a/src/main/java/com/spotify/github/v3/clients/GitHubClient.java +++ b/src/main/java/com/spotify/github/v3/clients/GitHubClient.java @@ -772,7 +772,7 @@ CompletableFuture processPossibleRedirects( final Request request = requestBuilder(newLocation) .url(newLocation) - .method("POST", response.request().body()) + .method(response.request().method(), response.request().body()) .build(); // Do the new call and complete the original future when the new call completes return call(request);