igniterealtime / REST-API-Client

Java REST API Client for the Openfire to manage Openfire instances by sending an REST/HTTP request to the server
Apache License 2.0
102 stars 62 forks source link

Miss application/json mediatype of exception #6

Closed ghost closed 9 years ago

ghost commented 9 years ago

When I want to get a unexisting user like: 1 > GET https://192.168.56.102:9091/plugins/restapi/v1/users/test-username 1 > Accept: application/json 1 > Authorization: P85x8916JzCKmlu2 Then I get exception: 2 < 404 2 < Access-Control-Allow-Credentials: true 2 < Access-Control-Allow-Headers: origin, content-type, accept, authorization 2 < Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS, HEAD 2 < Access-Control-Allow-Origin: * 2 < Content-Length: 187 2 < Content-Type: application/xml 2 < Date: Thu, 10 Sep 2015 05:52:28 GMT 2 < Expires: Thu, 01 Jan 1970 00:00:00 GMT 2 < Set-Cookie: JSESSIONID=1cp6jcny5fnx71jd8ki4h3h9sj;Path=/;Secure <?xml version="1.0" encoding="UTF-8" standalone="yes"?>UserNotFoundExceptionCould not get usertest-username

What I expect is the exception in json format, but actually it is in xml format even if I set accept header "Accept: application/json". This should be a bug that missing an ExceptionMapper on application/json.

Redor commented 9 years ago

Yes, you are right. I will change it soon.

Redor commented 9 years ago

The issue is fixed in the latest version of REST API plugin (version 1.1.6) The error response looks to the "Accept" header param.