Hi all
I want to allow xml
request via xhr
and I’ve got following error:
[debug] ** (Phoenix.NotAcceptableError) no supported media type in accept header, expected one of ["json", "xml"]
(phoenix) lib/phoenix/controller.ex:1153: Phoenix.Controller.refuse/2
(wp_admin) lib/wp_admin/web/router.ex:26: WpAdmin.Web.Router.api/2
(wp_admin) lib/wp_admin/web/router.ex:15: anonymous fn/1 in WpAdmin.Web.Router.__match_route__/4
(phoenix) lib/phoenix/router.ex:273: Phoenix.Router.__call__/1
(wp_admin) lib/wp_admin/web/endpoint.ex:1: WpAdmin.Web.Endpoint.plug_builder_call/2
(wp_admin) lib/plug/debugger.ex:123: WpAdmin.Web.Endpoint."call (overridable 3)"/2
(wp_admin) lib/wp_admin/web/endpoint.ex:1: WpAdmin.Web.Endpoint.call/2
(plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
and the request header looks like:
[{"host", "localhost:4000"}, {"connection", "keep-alive"},
{"pragma", "no-cache"}, {"cache-control", "no-cache"},
{"accept", "application/xml"}, {"sap-contextid-accept", "header"},
{"accept-language", "en-US"}, {"maxdataserviceversion", "3.0"},
{"user-agent",
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"},
{"referer", "http://localhost:4000/ui5"},
{"accept-encoding", "gzip, deflate, sdch, br"}]
as you can see, the value of accept is:
{"accept", "application/xml"}
in the config file I tried as follow:
config :mime, :types, %{
"application/xml" => ["xml"]
}
but it does not work at all.
What am I doing wrong?
Thanks