【发布时间】:2014-10-24 14:45:22
【问题描述】:
我正在使用 Devise 构建用户 API 函数。 这是referring tutorial。
以下是路线:
api_customers_path POST /customers(.:format) api/v1/customers#create {:format=>:json, :subdomain=>"api"}
api_customer_path GET /customers/:id(.:format) api/v1/customers#show {:format=>:json, :subdomain=>"api"}
PATCH /customers/:id(.:format) api/v1/customers#update {:format=>:json, :subdomain=>"api"}
PUT /customers/:id(.:format) api/v1/customers#update {:format=>:json, :subdomain=>"api"}
DELETE /customers/:id(.:format) api/v1/customers#destroy {:format=>:json, :subdomain=>"api"}
api_sessions_path POST /sessions(.:format) api/v1/sessions#create {:format=>:json, :subdomain=>"api"}
api_session_path DELETE /sessions/:id(.:format) api/v1/sessions#destroy {:format=>:json, :subdomain=>"api"}
我想知道如何测试 Create api (POST)。 我尝试使用 Postman 进行测试,但结果出乎意料。
我的测试有什么问题? 如果我测试 GET api,它可以正常工作。
【问题讨论】:
标签: ruby-on-rails ruby rspec devise