serialization - Phoenix - JSON API 406 Not Acceptable response -
i started brand new phoenix project , using jaserializer json api. followed documentation add project, have:
config/config.esx
config :phoenix, :format_encoders, "json-api": poison config :plug, :mimes, %{ "application/vnd.api+json" => ["json-api"] }
web/router.ex
pipeline :api plug :accepts, ["json-api"] plug jaserializer.contenttypenegotiation plug jaserializer.deserializer end
and used json api generator:
mix ja_serializer.gen.phoenix_api user users first_name:string last_name:string username:string email:string bio:text
i'm using postman test requests, , here's see when add headers it:
accept */* returned 200 accept application/vnd.api+json returned 406 accept application/* returned 406
so in phoenix server console, it's outputting:
[debug] ** (phoenix.notacceptableerror) no supported media type in accept header, expected 1 of ["json-api"]
i tried deleting _build folder , recompiling plugs seemed have work people, not me.
what did work removing plug jaserializer.contenttypenegotiation
in router, seems important piece shouldn't have remove.
does have ideas?
here's link issue submitted on ja_serializer
repo might helpful: https://github.com/agilionapps/ja_serializer/issues/138#issuecomment-232998259
Comments
Post a Comment