You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use swagger-inflector and swagger-codegen to create a java jersey2 app. All my unimplemented methods are mocked by inflector and return json. But the methods I implement return xml by default. The "@produces" annotation on my implemented controller methods seems to be ignored. The only way to make them return json is to set the "Accept" header with every request.
Controller class:
[...]
import javax.ws.rs.GET;
import javax.ws.rs.Produces;
public class CampaignController {
@GET
@Produces({"application/json"})
public Campaign listCampaigns(RequestContext context, Long customerId){
final Campaign campaign = new Campaign();
campaign.setName("dodo");
return campaign;
}
}
I use swagger-inflector and swagger-codegen to create a java jersey2 app. All my unimplemented methods are mocked by inflector and return json. But the methods I implement return xml by default. The "@produces" annotation on my implemented controller methods seems to be ignored. The only way to make them return json is to set the "Accept" header with every request.
Controller class:
Example requests:
Method I implemented, returns xml per default:
Mocked method, returns json even without "Accept" header:
The text was updated successfully, but these errors were encountered: