开发者

Is it possible to discover the expected params that is required in order to POST successfully?

Here is the scope of the issue Im dealing with...

I just took over an existing rails app that has a very complex business logic. The app is being used as a service. Json in, Json out.

Some of the resources expecting to find an abstract model in params hash and then via meta programming it expects to find the right object properties provided.

Giving that i have no docs, or unit tests, etc I'm finding it very difficul开发者_开发知识库t to figure out what to include in the params hash so the post/put operatins succeeds.


Are you able to boot it up with rails server and use the service? If so, you can just track what params it actually uses by adding <%= debug(params) if Rails.env.development? %> to your layout.


I suspect you don't know how to POST web requests to your JSON API. Try curl:

curl -fname=ariejan -fother_params=1 -fanother_param=@filename http://localhost:3000/test.json

Add the -f option automatically makes curl do a POST request. You'll get back the server response in JSON as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜