GUACAMOLE-5: Ensure all API errors are returned as JSON.

This commit is contained in:
Michael Jumper
2016-07-12 18:59:29 -07:00
parent fa286f549a
commit 60c672eeea

View File

@@ -21,6 +21,7 @@ package org.apache.guacamole.rest;
import java.util.Collection;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.guacamole.form.Field;
import org.apache.guacamole.protocol.GuacamoleStatus;
@@ -44,7 +45,10 @@ public class APIException extends WebApplicationException {
* The error that occurred.
*/
public APIException(APIError error) {
super(Response.status(error.getType().getStatus()).entity(error).build());
super(Response.status(error.getType().getStatus())
.type(MediaType.APPLICATION_JSON)
.entity(error)
.build());
}
/**