@@ -213,7 +213,7 @@ public LowLevelHttpResponse execute() throws IOException {
213213 }
214214
215215 String content = this .getContentAsString ();
216- Map <String , String > query = TestUtils . parseBody (content );
216+ Map <String , String > query = parseRequestContent (content );
217217 String accessToken = null ;
218218 String refreshToken = null ;
219219 String grantedScopesString = null ;
@@ -332,7 +332,7 @@ public LowLevelHttpResponse execute() throws IOException {
332332 new MockLowLevelHttpRequest (url ) {
333333 @ Override
334334 public LowLevelHttpResponse execute () throws IOException {
335- Map <String , String > parameters = TestUtils . parseBody (this .getContentAsString ());
335+ Map <String , String > parameters = parseRequestContent (this .getContentAsString ());
336336 String token = parameters .get ("token" );
337337 if (token == null ) {
338338 throw new IOException ("Token to revoke not found." );
@@ -364,7 +364,7 @@ public LowLevelHttpResponse execute() throws IOException {
364364 }
365365
366366 String content = this .getContentAsString ();
367- Map <String , String > query = TestUtils . parseBody (content );
367+ Map <String , String > query = parseRequestContent (content );
368368
369369 // Validate required fields.
370370 if (!query .containsKey ("code" )
@@ -420,6 +420,12 @@ public LowLevelHttpResponse execute() throws IOException {
420420 return super .buildRequest (method , url );
421421 }
422422
423+ private Map <String , String > parseRequestContent (String content ) throws IOException {
424+ if (content != null && content .trim ().startsWith ("{" )) {
425+ return TestUtils .parseJson (content );
426+ }
427+ return TestUtils .parseQuery (content );
428+ }
423429 private void validateAdditionalParameters (Map <String , String > query ) {
424430 if (additionalParameters .containsKey (query .get ("code" ))) {
425431 Map <String , String > additionalParametersMap = additionalParameters .get (query .get ("code" ));
0 commit comments