Hi all
When I make a request from the server, I’ve got
[debug] ** (Phoenix.NotAcceptableError) no supported media type in accept header, expected one of ["json", "xml"]
(phoenix) lib/phoenix/controller.ex:961: Phoenix.Controller.refuse/2
(northwind) web/router.ex:12: Northwind.Router.api/2
(northwind) web/router.ex:1: Northwind.Router.match_route/4
(northwind) web/router.ex:1: Northwind.Router.do_call/2
(northwind) lib/northwind/endpoint.ex:1: Northwind.Endpoint.phoenix_pipeline/1
(northwind) lib/plug/debugger.ex:123: Northwind.Endpoint."call (overridable 3)"/2
(northwind) lib/northwind/endpoint.ex:1: Northwind.Endpoint.call/2
(plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
(cowboy) src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4
The requested header looks as follow:
[{"host", "localhost:4000"}, {"connection", "keep-alive"},
{"accept", "application/xml"}, {"sap-contextid-accept", "header"},
{"accept-language", "en-US"}, {"maxdataserviceversion", "3.0"},
{"user-agent",
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36"},
{"referer", "http://localhost:4000/"},
{"accept-encoding", "gzip, deflate, sdch, br"},
and the configured pipeline:
pipeline :api do
plug Northwind.HeadersPlug #For output http header
plug :accepts, ["json", "xml"]
end
My problem is, that phoenix does not accept the request and I do not why.
I think the problem is because of, but not sure:
{"sap-contextid-accept", "header"}
I am using OpenUI5 frontend framework, for request data from phoenix.
Thanks