Skip to content

Commit

Permalink
fix: allow JSON response for XML metadata import [DHIS2-12026] (dhis2…
Browse files Browse the repository at this point in the history
  • Loading branch information
jbee authored Oct 26, 2021
1 parent a8a45e9 commit 93b8786
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,12 @@ public void testPostXmlMetadata_Pre38()
assertEquals( HttpStatus.OK, response.status() );
assertTrue( response.content( MediaType.APPLICATION_XML ).startsWith( "<importReport" ) );
}

@Test
public void testPostXmlMetadata_JsonResponse()
{
assertWebMessage( "OK", 200, "OK", null,
POST( "/38/metadata", Body( "<metadata></metadata>" ),
ContentType( "application/xml" ), Accept( "application/json" ) ).content( HttpStatus.OK ) );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public WebMessage postGmlMetadata( HttpServletRequest request )
return importReport( importReport ).withPlainResponseBefore( DhisApiVersion.V38 );
}

@PostMapping( value = "", consumes = APPLICATION_XML_VALUE, produces = APPLICATION_XML_VALUE )
@PostMapping( value = "", consumes = APPLICATION_XML_VALUE )
@ResponseBody
public WebMessage postXmlMetadata( HttpServletRequest request )
throws IOException
Expand Down

0 comments on commit 93b8786

Please sign in to comment.