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.
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"?>UserNotFoundException Could not get user test-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.