igniterealtime/REST-API-Client

Miss application/json mediatype of exception

Opened this issue · 2 comments

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

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

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

Redor commented

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.