diff --git a/api/sagan/src/main/java/io/spring/api/SaganApi.java b/api/sagan/src/main/java/io/spring/api/SaganApi.java index ffc35c7..8a64024 100644 --- a/api/sagan/src/main/java/io/spring/api/SaganApi.java +++ b/api/sagan/src/main/java/io/spring/api/SaganApi.java @@ -126,8 +126,7 @@ public Generation getGeneration(String slug, String name) { private HttpRequest.Builder requestBuilder(String uri) { // @formatter:off HttpRequest.Builder builder = HttpRequest.newBuilder() - .uri(URI.create(this.baseUrl + uri).normalize()) - .header("Accept", "application/json"); + .uri(URI.create(this.baseUrl + uri).normalize()); // @formatter:on if (this.username != null && this.accessToken != null) { var credentials = "%s:%s".formatted(this.username, this.accessToken); diff --git a/api/sagan/src/test/java/io/spring/api/SaganApiTests.java b/api/sagan/src/test/java/io/spring/api/SaganApiTests.java index 0a2e794..84e4e33 100644 --- a/api/sagan/src/test/java/io/spring/api/SaganApiTests.java +++ b/api/sagan/src/test/java/io/spring/api/SaganApiTests.java @@ -76,7 +76,7 @@ public void getProjectsWhenExistsThenSuccess() throws Exception { var recordedRequest = this.server.takeRequest(); assertThat(recordedRequest.getMethod()).isEqualTo("GET"); assertThat(recordedRequest.getPath()).isEqualTo("/projects"); - assertThat(recordedRequest.getHeader("Accept")).isEqualTo("application/json"); + assertThat(recordedRequest.getHeader("Accept")).isNull(); assertThat(recordedRequest.getHeader("Authorization")).isEqualTo("Basic %s".formatted(AUTH_TOKEN)); } @@ -92,7 +92,7 @@ public void getProjectWhenUsernameAndAccessTokenAreNullThenSuccess() throws Exce var recordedRequest = this.server.takeRequest(); assertThat(recordedRequest.getMethod()).isEqualTo("GET"); assertThat(recordedRequest.getPath()).isEqualTo("/projects/spring-security"); - assertThat(recordedRequest.getHeader("Accept")).isEqualTo("application/json"); + assertThat(recordedRequest.getHeader("Accept")).isNull(); assertThat(recordedRequest.getHeaders().names().contains("Authorization")).isFalse(); } @@ -107,7 +107,7 @@ public void getProjectWhenExistsThenSuccess() throws Exception { var recordedRequest = this.server.takeRequest(); assertThat(recordedRequest.getMethod()).isEqualTo("GET"); assertThat(recordedRequest.getPath()).isEqualTo("/projects/spring-security"); - assertThat(recordedRequest.getHeader("Accept")).isEqualTo("application/json"); + assertThat(recordedRequest.getHeader("Accept")).isNull(); assertThat(recordedRequest.getHeader("Authorization")).isEqualTo("Basic %s".formatted(AUTH_TOKEN)); } @@ -125,7 +125,7 @@ public void getReleasesWhenExistsThenSuccess() throws Exception { var recordedRequest = this.server.takeRequest(); assertThat(recordedRequest.getMethod()).isEqualTo("GET"); assertThat(recordedRequest.getPath()).isEqualTo("/projects/spring-security/releases"); - assertThat(recordedRequest.getHeader("Accept")).isEqualTo("application/json"); + assertThat(recordedRequest.getHeader("Accept")).isNull(); assertThat(recordedRequest.getHeader("Authorization")).isEqualTo("Basic %s".formatted(AUTH_TOKEN)); } @@ -139,7 +139,7 @@ public void getReleasesWhenEndOfLifeThenEmpty() throws Exception { var recordedRequest = this.server.takeRequest(); assertThat(recordedRequest.getMethod()).isEqualTo("GET"); assertThat(recordedRequest.getPath()).isEqualTo("/projects/spring-social/releases"); - assertThat(recordedRequest.getHeader("Accept")).isEqualTo("application/json"); + assertThat(recordedRequest.getHeader("Accept")).isNull(); assertThat(recordedRequest.getHeader("Authorization")).isEqualTo("Basic %s".formatted(AUTH_TOKEN)); } @@ -151,7 +151,7 @@ public void createReleaseWhenValidParametersThenSuccess() throws Exception { var recordedRequest = this.server.takeRequest(); assertThat(recordedRequest.getMethod()).isEqualTo("POST"); assertThat(recordedRequest.getPath()).isEqualTo("/projects/spring-security/releases"); - assertThat(recordedRequest.getHeader("Accept")).isEqualTo("application/json"); + assertThat(recordedRequest.getHeader("Accept")).isNull(); assertThat(recordedRequest.getHeader("Content-Type")).isEqualTo("application/json"); assertThat(recordedRequest.getHeader("Authorization")).isEqualTo("Basic %s".formatted(AUTH_TOKEN)); assertThat(recordedRequest.getBody().readString(Charset.defaultCharset())) @@ -170,7 +170,7 @@ public void getReleaseWhenExistsThenSuccess() throws Exception { var recordedRequest = this.server.takeRequest(); assertThat(recordedRequest.getMethod()).isEqualTo("GET"); assertThat(recordedRequest.getPath()).isEqualTo("/projects/spring-security/releases/6.1.0"); - assertThat(recordedRequest.getHeader("Accept")).isEqualTo("application/json"); + assertThat(recordedRequest.getHeader("Accept")).isNull(); assertThat(recordedRequest.getHeader("Authorization")).isEqualTo("Basic %s".formatted(AUTH_TOKEN)); } @@ -182,7 +182,7 @@ public void deleteReleaseWhenValidParametersThenSuccess() throws Exception { var recordedRequest = this.server.takeRequest(); assertThat(recordedRequest.getMethod()).isEqualTo("DELETE"); assertThat(recordedRequest.getPath()).isEqualTo("/projects/spring-security/releases/6.1.0"); - assertThat(recordedRequest.getHeader("Accept")).isEqualTo("application/json"); + assertThat(recordedRequest.getHeader("Accept")).isNull(); assertThat(recordedRequest.getHeader("Authorization")).isEqualTo("Basic %s".formatted(AUTH_TOKEN)); } @@ -207,7 +207,7 @@ public void getGenerationsWhenExistsThenSuccess() throws Exception { var recordedRequest = this.server.takeRequest(); assertThat(recordedRequest.getMethod()).isEqualTo("GET"); assertThat(recordedRequest.getPath()).isEqualTo("/projects/spring-security/generations"); - assertThat(recordedRequest.getHeader("Accept")).isEqualTo("application/json"); + assertThat(recordedRequest.getHeader("Accept")).isNull(); assertThat(recordedRequest.getHeader("Authorization")).isEqualTo("Basic %s".formatted(AUTH_TOKEN)); } @@ -221,7 +221,7 @@ public void getGenerationsWhenEndOfLifeThenEmpty() throws Exception { var recordedRequest = this.server.takeRequest(); assertThat(recordedRequest.getMethod()).isEqualTo("GET"); assertThat(recordedRequest.getPath()).isEqualTo("/projects/spring-social/generations"); - assertThat(recordedRequest.getHeader("Accept")).isEqualTo("application/json"); + assertThat(recordedRequest.getHeader("Accept")).isNull(); assertThat(recordedRequest.getHeader("Authorization")).isEqualTo("Basic %s".formatted(AUTH_TOKEN)); } @@ -239,7 +239,7 @@ public void getGenerationWhenExistsThenSuccess() throws Exception { var recordedRequest = this.server.takeRequest(); assertThat(recordedRequest.getMethod()).isEqualTo("GET"); assertThat(recordedRequest.getPath()).isEqualTo("/projects/spring-security/generations/6.1.x"); - assertThat(recordedRequest.getHeader("Accept")).isEqualTo("application/json"); + assertThat(recordedRequest.getHeader("Accept")).isNull(); assertThat(recordedRequest.getHeader("Authorization")).isEqualTo("Basic %s".formatted(AUTH_TOKEN)); }