怎么写rRest ful api测试脚本?参数如果是json格式怎么写?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

怎么写rRest ful api测试脚本?参数如果是json格式怎么写?

littleboy
请问,如果使用post、put方法时如果参数是json格式怎么写?谢谢~
Reply | Threaded
Open this post in threaded view
|

Re: 怎么写rRest ful api测试脚本?参数如果是json格式怎么写?

WaitUntil
def json = '{"tenant_code":"XXX","user_name":"XX","password":"X","skip_duplicate_entries":true,"type":"0"}';
// 发起请求
HTTPResponse result = request.POST("<a href="http://192.XXX.XX.XXX:XXXX/XXX/XX/login">http://192.XXX.XX.XXX:XXXX/XXX/XX/login", json.getBytes(), headers());
Reply | Threaded
Open this post in threaded view
|

Re: 怎么写rRest ful api测试脚本?参数如果是json格式怎么写?

littleboy
多谢~我顺便再验证下request是否支持put、delete方法