问题
I'm attempting to create mock api services for testing purposes. We are already using Apiary on another team so I'm starting there.
So far, I've noticed that if I want to have two separate calls requires mocking out of both requests. For example to get the notes with ids 1 and 2 requires explicitly writing out responses like:
/notes/1 /notes/2
Is there a way to avoid this? Admittedly I'm still ramping up on creating blueprints.
回答1:
Have a look at private-e9e59-pingdomcheck.apiary-mock.com/v1/gists/1. The number 1
is {id}
here. You of course get only the general defined response (like if I used id 42).
There are more things being done right now in MSON. Once it's released, different replies for different parameters in request will be possible.
来源:https://stackoverflow.com/questions/28682002/create-mock-service-api-using-apiary