Skip to content

Commit 1e4dd71

Browse files
ngocnhan-tran1996rwinch
authored andcommitted
Remove APPLICATION_JSON_UTF8 usage
Signed-off-by: Tran Ngoc Nhan <[email protected]>
1 parent 6118587 commit 1e4dd71

15 files changed

+34
-94
lines changed

oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultOAuth2TokenRequestHeadersConverter.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,7 +24,6 @@
2424
import org.springframework.http.HttpHeaders;
2525
import org.springframework.http.MediaType;
2626
import org.springframework.http.RequestEntity;
27-
import org.springframework.security.http.MediaTypes;
2827
import org.springframework.security.oauth2.client.registration.ClientRegistration;
2928
import org.springframework.security.oauth2.core.ClientAuthenticationMethod;
3029

@@ -99,7 +98,6 @@ public void setEncodeClientCredentials(boolean encodeClientCredentials) {
9998
*/
10099
static <T extends AbstractOAuth2AuthorizationGrantRequest> DefaultOAuth2TokenRequestHeadersConverter<T> withCharsetUtf8() {
101100
DefaultOAuth2TokenRequestHeadersConverter<T> converter = new DefaultOAuth2TokenRequestHeadersConverter<>();
102-
converter.accept = List.of(MediaTypes.APPLICATION_JSON_UTF8);
103101
converter.contentType = APPLICATION_FORM_URLENCODED_UTF8;
104102
return converter;
105103
}

oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultAuthorizationCodeTokenResponseClientTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,7 +33,6 @@
3333
import org.springframework.http.HttpHeaders;
3434
import org.springframework.http.HttpMethod;
3535
import org.springframework.http.MediaType;
36-
import org.springframework.security.http.MediaTypes;
3736
import org.springframework.security.oauth2.client.registration.ClientRegistration;
3837
import org.springframework.security.oauth2.client.registration.TestClientRegistrations;
3938
import org.springframework.security.oauth2.core.ClientAuthenticationMethod;
@@ -119,7 +118,7 @@ public void getTokenResponseWhenSuccessResponseThenReturnAccessTokenResponse() t
119118
Instant expiresAtAfter = Instant.now().plusSeconds(3600);
120119
RecordedRequest recordedRequest = this.server.takeRequest();
121120
assertThat(recordedRequest.getMethod()).isEqualTo(HttpMethod.POST.toString());
122-
assertThat(recordedRequest.getHeader(HttpHeaders.ACCEPT)).isEqualTo(MediaTypes.APPLICATION_JSON_UTF8_VALUE);
121+
assertThat(recordedRequest.getHeader(HttpHeaders.ACCEPT)).isEqualTo(MediaType.APPLICATION_JSON_VALUE);
123122
assertThat(recordedRequest.getHeader(HttpHeaders.CONTENT_TYPE))
124123
.isEqualTo(MediaType.APPLICATION_FORM_URLENCODED_VALUE + ";charset=UTF-8");
125124
String formParameters = recordedRequest.getBody().readUtf8();

oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultClientCredentialsTokenResponseClientTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,7 +33,6 @@
3333
import org.springframework.http.HttpHeaders;
3434
import org.springframework.http.HttpMethod;
3535
import org.springframework.http.MediaType;
36-
import org.springframework.security.http.MediaTypes;
3736
import org.springframework.security.oauth2.client.registration.ClientRegistration;
3837
import org.springframework.security.oauth2.client.registration.TestClientRegistrations;
3938
import org.springframework.security.oauth2.core.ClientAuthenticationMethod;
@@ -122,7 +121,7 @@ public void getTokenResponseWhenSuccessResponseThenReturnAccessTokenResponse() t
122121
Instant expiresAtAfter = Instant.now().plusSeconds(3600);
123122
RecordedRequest recordedRequest = this.server.takeRequest();
124123
assertThat(recordedRequest.getMethod()).isEqualTo(HttpMethod.POST.toString());
125-
assertThat(recordedRequest.getHeader(HttpHeaders.ACCEPT)).isEqualTo(MediaTypes.APPLICATION_JSON_UTF8_VALUE);
124+
assertThat(recordedRequest.getHeader(HttpHeaders.ACCEPT)).isEqualTo(MediaType.APPLICATION_JSON_VALUE);
126125
assertThat(recordedRequest.getHeader(HttpHeaders.CONTENT_TYPE))
127126
.isEqualTo(MediaType.APPLICATION_FORM_URLENCODED_VALUE + ";charset=UTF-8");
128127
String formParameters = recordedRequest.getBody().readUtf8();

oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultJwtBearerTokenResponseClientTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,7 +29,6 @@
2929
import org.springframework.http.HttpHeaders;
3030
import org.springframework.http.HttpMethod;
3131
import org.springframework.http.MediaType;
32-
import org.springframework.security.http.MediaTypes;
3332
import org.springframework.security.oauth2.client.registration.ClientRegistration;
3433
import org.springframework.security.oauth2.client.registration.TestClientRegistrations;
3534
import org.springframework.security.oauth2.core.AuthorizationGrantType;
@@ -116,7 +115,7 @@ public void getTokenResponseWhenSuccessResponseThenReturnAccessTokenResponse() t
116115
Instant expiresAtAfter = Instant.now().plusSeconds(3600);
117116
RecordedRequest recordedRequest = this.server.takeRequest();
118117
assertThat(recordedRequest.getMethod()).isEqualTo(HttpMethod.POST.toString());
119-
assertThat(recordedRequest.getHeader(HttpHeaders.ACCEPT)).isEqualTo(MediaTypes.APPLICATION_JSON_UTF8_VALUE);
118+
assertThat(recordedRequest.getHeader(HttpHeaders.ACCEPT)).isEqualTo(MediaType.APPLICATION_JSON_VALUE);
120119
assertThat(recordedRequest.getHeader(HttpHeaders.CONTENT_TYPE))
121120
.isEqualTo(MediaType.APPLICATION_FORM_URLENCODED_VALUE + ";charset=UTF-8");
122121
String formParameters = recordedRequest.getBody().readUtf8();

oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultOAuth2TokenRequestHeadersConverterTests.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,9 +35,6 @@
3535
*/
3636
public class DefaultOAuth2TokenRequestHeadersConverterTests {
3737

38-
private static final MediaType APPLICATION_JSON_UTF8 = new MediaType(MediaType.APPLICATION_JSON,
39-
StandardCharsets.UTF_8);
40-
4138
private static final MediaType APPLICATION_FORM_URLENCODED_UTF8 = new MediaType(
4239
MediaType.APPLICATION_FORM_URLENCODED, StandardCharsets.UTF_8);
4340

@@ -92,7 +89,7 @@ public void convertWhenWithCharsetUtf8AndEncodeClientCredentialsTrueThenConverts
9289
// @formatter:on
9390
OAuth2ClientCredentialsGrantRequest grantRequest = new OAuth2ClientCredentialsGrantRequest(clientRegistration);
9491
HttpHeaders defaultHeaders = this.converter.convert(grantRequest);
95-
assertThat(defaultHeaders.getAccept()).containsExactly(APPLICATION_JSON_UTF8);
92+
assertThat(defaultHeaders.getAccept()).containsExactly(MediaType.APPLICATION_JSON);
9693
assertThat(defaultHeaders.getContentType()).isEqualTo(APPLICATION_FORM_URLENCODED_UTF8);
9794
assertThat(defaultHeaders.getFirst(HttpHeaders.AUTHORIZATION))
9895
.isEqualTo("Basic Y2xpZW50SWQ6Y2xpZW50U2VjcmV0JTNE");
@@ -110,7 +107,7 @@ public void convertWhenWithCharsetUtf8EncodeClientCredentialsFalseThenConvertsWi
110107
// @formatter:on
111108
OAuth2ClientCredentialsGrantRequest grantRequest = new OAuth2ClientCredentialsGrantRequest(clientRegistration);
112109
HttpHeaders defaultHeaders = this.converter.convert(grantRequest);
113-
assertThat(defaultHeaders.getAccept()).containsExactly(APPLICATION_JSON_UTF8);
110+
assertThat(defaultHeaders.getAccept()).containsExactly(MediaType.APPLICATION_JSON);
114111
assertThat(defaultHeaders.getContentType()).isEqualTo(APPLICATION_FORM_URLENCODED_UTF8);
115112
assertThat(defaultHeaders.getFirst(HttpHeaders.AUTHORIZATION))
116113
.isEqualTo("Basic Y2xpZW50SWQ6Y2xpZW50U2VjcmV0PQ==");

oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultPasswordTokenResponseClientTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,7 +33,6 @@
3333
import org.springframework.http.HttpHeaders;
3434
import org.springframework.http.HttpMethod;
3535
import org.springframework.http.MediaType;
36-
import org.springframework.security.http.MediaTypes;
3736
import org.springframework.security.oauth2.client.registration.ClientRegistration;
3837
import org.springframework.security.oauth2.client.registration.TestClientRegistrations;
3938
import org.springframework.security.oauth2.core.ClientAuthenticationMethod;
@@ -116,7 +115,7 @@ public void getTokenResponseWhenSuccessResponseThenReturnAccessTokenResponse() t
116115
Instant expiresAtAfter = Instant.now().plusSeconds(3600);
117116
RecordedRequest recordedRequest = this.server.takeRequest();
118117
assertThat(recordedRequest.getMethod()).isEqualTo(HttpMethod.POST.toString());
119-
assertThat(recordedRequest.getHeader(HttpHeaders.ACCEPT)).isEqualTo(MediaTypes.APPLICATION_JSON_UTF8_VALUE);
118+
assertThat(recordedRequest.getHeader(HttpHeaders.ACCEPT)).isEqualTo(MediaType.APPLICATION_JSON_VALUE);
120119
assertThat(recordedRequest.getHeader(HttpHeaders.CONTENT_TYPE))
121120
.isEqualTo(MediaType.APPLICATION_FORM_URLENCODED_VALUE + ";charset=UTF-8");
122121
String formParameters = recordedRequest.getBody().readUtf8();

oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultRefreshTokenTokenResponseClientTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,7 +34,6 @@
3434
import org.springframework.http.HttpHeaders;
3535
import org.springframework.http.HttpMethod;
3636
import org.springframework.http.MediaType;
37-
import org.springframework.security.http.MediaTypes;
3837
import org.springframework.security.oauth2.client.registration.ClientRegistration;
3938
import org.springframework.security.oauth2.client.registration.TestClientRegistrations;
4039
import org.springframework.security.oauth2.core.ClientAuthenticationMethod;
@@ -118,7 +117,7 @@ public void getTokenResponseWhenSuccessResponseThenReturnAccessTokenResponse() t
118117
Instant expiresAtAfter = Instant.now().plusSeconds(3600);
119118
RecordedRequest recordedRequest = this.server.takeRequest();
120119
assertThat(recordedRequest.getMethod()).isEqualTo(HttpMethod.POST.toString());
121-
assertThat(recordedRequest.getHeader(HttpHeaders.ACCEPT)).isEqualTo(MediaTypes.APPLICATION_JSON_UTF8_VALUE);
120+
assertThat(recordedRequest.getHeader(HttpHeaders.ACCEPT)).isEqualTo(MediaType.APPLICATION_JSON_VALUE);
122121
assertThat(recordedRequest.getHeader(HttpHeaders.CONTENT_TYPE))
123122
.isEqualTo(MediaType.APPLICATION_FORM_URLENCODED_VALUE + ";charset=UTF-8");
124123
assertThat(recordedRequest.getHeader(HttpHeaders.AUTHORIZATION)).startsWith("Basic ");

oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultTokenExchangeTokenResponseClientTests.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -149,8 +149,7 @@ public void getTokenResponseWhenSuccessResponseThenReturnAccessTokenResponse() t
149149
Instant expiresAtAfter = Instant.now().plusSeconds(3600);
150150
RecordedRequest recordedRequest = this.server.takeRequest();
151151
assertThat(recordedRequest.getMethod()).isEqualTo(HttpMethod.POST.toString());
152-
assertThat(recordedRequest.getHeader(HttpHeaders.ACCEPT))
153-
.isEqualTo(MediaType.APPLICATION_JSON_VALUE + ";charset=UTF-8");
152+
assertThat(recordedRequest.getHeader(HttpHeaders.ACCEPT)).isEqualTo(MediaType.APPLICATION_JSON_VALUE);
154153
assertThat(recordedRequest.getHeader(HttpHeaders.CONTENT_TYPE))
155154
.isEqualTo(MediaType.APPLICATION_FORM_URLENCODED_VALUE + ";charset=UTF-8");
156155
String formParameters = recordedRequest.getBody().readUtf8();
@@ -189,8 +188,7 @@ public void getTokenResponseWhenSubjectTokenIsJwtThenSubjectTokenTypeIsJwt() thr
189188
Instant expiresAtAfter = Instant.now().plusSeconds(3600);
190189
RecordedRequest recordedRequest = this.server.takeRequest();
191190
assertThat(recordedRequest.getMethod()).isEqualTo(HttpMethod.POST.toString());
192-
assertThat(recordedRequest.getHeader(HttpHeaders.ACCEPT))
193-
.isEqualTo(MediaType.APPLICATION_JSON_VALUE + ";charset=UTF-8");
191+
assertThat(recordedRequest.getHeader(HttpHeaders.ACCEPT)).isEqualTo(MediaType.APPLICATION_JSON_VALUE);
194192
assertThat(recordedRequest.getHeader(HttpHeaders.CONTENT_TYPE))
195193
.isEqualTo(MediaType.APPLICATION_FORM_URLENCODED_VALUE + ";charset=UTF-8");
196194
String formParameters = recordedRequest.getBody().readUtf8();
@@ -229,8 +227,7 @@ public void getTokenResponseWhenActorTokenIsNotNullThenActorParametersAreSent()
229227
Instant expiresAtAfter = Instant.now().plusSeconds(3600);
230228
RecordedRequest recordedRequest = this.server.takeRequest();
231229
assertThat(recordedRequest.getMethod()).isEqualTo(HttpMethod.POST.toString());
232-
assertThat(recordedRequest.getHeader(HttpHeaders.ACCEPT))
233-
.isEqualTo(MediaType.APPLICATION_JSON_VALUE + ";charset=UTF-8");
230+
assertThat(recordedRequest.getHeader(HttpHeaders.ACCEPT)).isEqualTo(MediaType.APPLICATION_JSON_VALUE);
234231
assertThat(recordedRequest.getHeader(HttpHeaders.CONTENT_TYPE))
235232
.isEqualTo(MediaType.APPLICATION_FORM_URLENCODED_VALUE + ";charset=UTF-8");
236233
String formParameters = recordedRequest.getBody().readUtf8();
@@ -271,8 +268,7 @@ public void getTokenResponseWhenActorTokenIsJwtThenActorTokenTypeIsJwt() throws
271268
Instant expiresAtAfter = Instant.now().plusSeconds(3600);
272269
RecordedRequest recordedRequest = this.server.takeRequest();
273270
assertThat(recordedRequest.getMethod()).isEqualTo(HttpMethod.POST.toString());
274-
assertThat(recordedRequest.getHeader(HttpHeaders.ACCEPT))
275-
.isEqualTo(MediaType.APPLICATION_JSON_VALUE + ";charset=UTF-8");
271+
assertThat(recordedRequest.getHeader(HttpHeaders.ACCEPT)).isEqualTo(MediaType.APPLICATION_JSON_VALUE);
276272
assertThat(recordedRequest.getHeader(HttpHeaders.CONTENT_TYPE))
277273
.isEqualTo(MediaType.APPLICATION_FORM_URLENCODED_VALUE + ";charset=UTF-8");
278274
String formParameters = recordedRequest.getBody().readUtf8();

oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/JwtBearerGrantRequestEntityConverterTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,6 @@
2525
import org.springframework.http.HttpMethod;
2626
import org.springframework.http.MediaType;
2727
import org.springframework.http.RequestEntity;
28-
import org.springframework.security.http.MediaTypes;
2928
import org.springframework.security.oauth2.client.registration.ClientRegistration;
3029
import org.springframework.security.oauth2.client.registration.TestClientRegistrations;
3130
import org.springframework.security.oauth2.core.AuthorizationGrantType;
@@ -135,7 +134,7 @@ public void convertWhenGrantRequestValidThenConverts() {
135134
assertThat(requestEntity.getUrl().toASCIIString())
136135
.isEqualTo(clientRegistration.getProviderDetails().getTokenUri());
137136
HttpHeaders headers = requestEntity.getHeaders();
138-
assertThat(headers.getAccept()).contains(MediaType.valueOf(MediaTypes.APPLICATION_JSON_UTF8_VALUE));
137+
assertThat(headers.getAccept()).contains(MediaType.APPLICATION_JSON);
139138
assertThat(headers.getContentType())
140139
.isEqualTo(MediaType.valueOf(MediaType.APPLICATION_FORM_URLENCODED_VALUE + ";charset=UTF-8"));
141140
assertThat(headers.getFirst(HttpHeaders.AUTHORIZATION)).startsWith("Basic ");

oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2AuthorizationCodeGrantRequestEntityConverterTests.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@
2828
import org.springframework.http.HttpMethod;
2929
import org.springframework.http.MediaType;
3030
import org.springframework.http.RequestEntity;
31-
import org.springframework.security.http.MediaTypes;
3231
import org.springframework.security.oauth2.client.registration.ClientRegistration;
3332
import org.springframework.security.oauth2.client.registration.TestClientRegistrations;
3433
import org.springframework.security.oauth2.core.AuthorizationGrantType;
@@ -139,7 +138,7 @@ public void convertWhenGrantRequestValidThenConverts() {
139138
assertThat(requestEntity.getUrl().toASCIIString())
140139
.isEqualTo(clientRegistration.getProviderDetails().getTokenUri());
141140
HttpHeaders headers = requestEntity.getHeaders();
142-
assertThat(headers.getAccept()).contains(MediaTypes.APPLICATION_JSON_UTF8);
141+
assertThat(headers.getAccept()).contains(MediaType.APPLICATION_JSON);
143142
assertThat(headers.getContentType())
144143
.isEqualTo(MediaType.valueOf(MediaType.APPLICATION_FORM_URLENCODED_VALUE + ";charset=UTF-8"));
145144
assertThat(headers.getFirst(HttpHeaders.AUTHORIZATION)).isEqualTo("Basic Y2xpZW50SWQ6Y2xpZW50U2VjcmV0JTNE");
@@ -178,7 +177,7 @@ public void convertWhenPkceGrantRequestValidThenConverts() {
178177
assertThat(requestEntity.getUrl().toASCIIString())
179178
.isEqualTo(clientRegistration.getProviderDetails().getTokenUri());
180179
HttpHeaders headers = requestEntity.getHeaders();
181-
assertThat(headers.getAccept()).contains(MediaTypes.APPLICATION_JSON_UTF8);
180+
assertThat(headers.getAccept()).contains(MediaType.APPLICATION_JSON);
182181
assertThat(headers.getContentType())
183182
.isEqualTo(MediaType.valueOf(MediaType.APPLICATION_FORM_URLENCODED_VALUE + ";charset=UTF-8"));
184183
assertThat(headers.getFirst(HttpHeaders.AUTHORIZATION)).isNull();

oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2ClientCredentialsGrantRequestEntityConverterTests.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,7 +30,6 @@
3030
import org.springframework.http.HttpMethod;
3131
import org.springframework.http.MediaType;
3232
import org.springframework.http.RequestEntity;
33-
import org.springframework.security.http.MediaTypes;
3433
import org.springframework.security.oauth2.client.registration.ClientRegistration;
3534
import org.springframework.security.oauth2.client.registration.TestClientRegistrations;
3635
import org.springframework.security.oauth2.core.AuthorizationGrantType;
@@ -124,7 +123,7 @@ public void convertWhenGrantRequestValidThenConverts() {
124123
assertThat(requestEntity.getUrl().toASCIIString())
125124
.isEqualTo(clientRegistration.getProviderDetails().getTokenUri());
126125
HttpHeaders headers = requestEntity.getHeaders();
127-
assertThat(headers.getAccept()).contains(MediaTypes.APPLICATION_JSON_UTF8);
126+
assertThat(headers.getAccept()).contains(MediaType.APPLICATION_JSON);
128127
assertThat(headers.getContentType())
129128
.isEqualTo(MediaType.valueOf(MediaType.APPLICATION_FORM_URLENCODED_VALUE + ";charset=UTF-8"));
130129
assertThat(headers.getFirst(HttpHeaders.AUTHORIZATION)).startsWith("Basic ");
@@ -153,7 +152,7 @@ public void convertWhenSpecialCharactersThenConvertsWithEncodedClientCredentials
153152
assertThat(requestEntity.getUrl().toASCIIString())
154153
.isEqualTo(clientRegistration.getProviderDetails().getTokenUri());
155154
HttpHeaders headers = requestEntity.getHeaders();
156-
assertThat(headers.getAccept()).contains(MediaTypes.APPLICATION_JSON_UTF8);
155+
assertThat(headers.getAccept()).contains(MediaType.APPLICATION_JSON);
157156
assertThat(headers.getContentType())
158157
.isEqualTo(MediaType.valueOf(MediaType.APPLICATION_FORM_URLENCODED_VALUE + ";charset=UTF-8"));
159158
String urlEncodedClientCredential = URLEncoder.encode(clientCredentialWithAnsiKeyboardSpecialCharacters,

0 commit comments

Comments
 (0)