use of io.appium.espressoserver.lib.model.gsonadapters.AppiumStatusAdapter in project appium-espresso-driver by appium.
the class Server method serve.
@Override
public Response serve(IHTTPSession session) {
GsonBuilder gsonBuilder = new GsonBuilder().serializeNulls();
BaseResponse response;
try {
response = router.route(session);
} catch (Exception e) {
String[] stackTrace = getStackTrace(e);
response = new ErrorResponse(Response.Status.INTERNAL_ERROR, "Internal error has occurred", stackTrace);
}
gsonBuilder.registerTypeAdapter(AppiumStatus.class, new AppiumStatusAdapter());
return newFixedLengthResponse(response.getHttpStatus(), MediaType.APPLICATION_JSON, gsonBuilder.create().toJson(response));
}
Aggregations