[英]How to read and edit a json file and send it as a request in karate dsl
The code i am trying out is : 我正在尝试的代码是:
Given url ApiAdminURL 给定URL ApiAdminURL
And path AdminPath 和路径AdminPath
And header apigateway-apikey = apiGatewayKey 和标头apigateway-apikey = apiGatewayKey
And header apigateway-basepath = 'lambdaTest' 和标题apigateway-basepath ='lambdaTest'
** json myReq = read('users.json') ** json myReq =已读('users.json')
** set myReq.apiConf.subscriptionTiers = ["Unlimited"] **设置myReq.apiConf.subscriptionTiers = [“ Unlimited”]
** print 'my subscriptions : ', myReq.apiConf **打印“我的订阅:”,myReq.apiConf
And request read('myReq.json') 并请求读取('myReq.json')
When method post 方法发布时
Then status 200 然后状态200
i can read the json file and get it in a variable "myReq" and now i want to send this edited myReq. 我可以读取json文件,并在变量“ myReq”中获取它,现在我想发送此已编辑的myReq。 json as my request but i am not able to do that. json作为我的请求,但我无法做到这一点。
Can someone please help. 有人可以帮忙吗?
Instead of And request read('myReq.json')
而不是And request read('myReq.json')
Shouldn't this work ! 这项工作不应该!
And request myReq
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.