JujaLabs / itevents

Resource to subscribe on it events
Apache License 2.0
7 stars 5 forks source link

Exceptions is not converting to a HTTP codes #191

Open IgorMaksymov opened 8 years ago

IgorMaksymov commented 8 years ago

This is a SWAGGER and BROWSERS issue, in Intellij Idea ​Test Restful Webservice all works fine

Exceptions is not handled. as an example, try to login with incorrect login. You will get code 0, server error.

looks like the problem is here <mvc:annotation-driven content-negotiation-manager="contentNegotiationManager"/>

@romach told this:

у меня есть догадка, в чем может быть причина: сервер, когда формирует http-ответ добавляет в него заголовок (Response header) Content-Type:. С помощью аннотации mvc:annotation-driven content-negotiation-managerмы говорим спрингу, чтобы он добавлял заголовок Content-Type:application/json; charset=UTF-8. Этот заголовок означает, какого типа ответ сервера. С другой стороны, браузер, когда посылает запрос, отправляет на сервер заголовок с типами контента, которые он принимает, например, Google Chrome посылает такой заголовок: Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8. Соответственно, у нас несовпадение этих значений.

IgorMaksymov commented 8 years ago

this problem appeared after merging this https://github.com/JuniorsJava/itevents/commit/285dc13d4c900ea4d7f40e84a82bb37f25752143

IgorMaksymov commented 8 years ago

This is a SWAGGER issue, in Intellij Idea Test Restful Webservice all works fine