dreamhead / moco

Easy Setup Stub Server
MIT License
4.36k stars 1.08k forks source link

unique request id #268

Open suxuliaoyuan opened 4 years ago

suxuliaoyuan commented 4 years ago

post request, json: { "input":"{\"amount\":10.0,\"request_id\":\"20191029010433\"}} 'request_id' is unique for each request, how can I deal with such request and return a unique response_id

dreamhead commented 4 years ago

You may need random function to generate unique id.

https://github.com/dreamhead/moco/blob/master/moco-doc/apis.md#random

suxuliaoyuan commented 4 years ago

Thanks, But the request I received was json:{"input":"{"amount":10.0,"request_id":"20191029010433}"}. The value of json is a josn and 'request_id' is changing , how should I math received just use "amount"?

iamxiaoguizi commented 4 years ago

@suxuliaoyuan try to use json_path https://github.com/dreamhead/moco/blob/master/moco-doc/apis.md#jsonpath