pheonix api options call shows empty params

自作多情 提交于 2019-12-11 15:46:09

问题


I am making a phoenix api for my react frontend and I am sending a post request with an object of objects, and I figured that I need to use options in the api to get them beause with post it just failed, but now the params are empty. Why is that?

What I send:

axios
.post(PAYMENT_SERVER_URL, {
  description,
  email: token.email,
  source: token.id,
  subscriptionID
})

api router:

pipeline :api do
  plug(:accepts, ["json"])
end

scope "/api", MyApiWeb do
  pipe_through(:api)

  options("/users", UserController, :create)
end

api usercontroller

def create(conn, params) do
  IO.puts(options)
end

for now I'd be very happy with just logging it out.

来源:https://stackoverflow.com/questions/51454195/pheonix-api-options-call-shows-empty-params

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!