karate - 如何设置基本 API?我看到从第一个 API 的响应中添加了双引号
问题描述
Given path '/api/metrics/product/ABC'
When method get
* def id = get response
* print id
* def basePathProducts = '/another/api/' + id + '/param'
Given path basePathProducts
When method GET
Then status 200
12:59:28.447 [main] INFO com.intuit.karate.StepDefs - [print] "5ca627bf3edd851238e59c9e" 2019 年 4 月 16 日 12:59:28 PM org.glassfish.jersey.logging.LoggingInterceptor 日志严重:2 * 发送客户端请求在主线程 2 > GET
http://localhost:8080/API/ANOTHER/API/%225ca627bf3edd851238e59c9e%22/PARAM
解决方案
你的帖子真的很难理解。
尝试使用
Given url yourURLVariable + 'another/api/'+ id + '/param'
有关更多信息,请参阅此:https ://stackoverflow.com/a/54477346/10791639
编辑:您的参数有问题。
* def id = "5ca627bf3edd851238e59c9e"
* print id
给出:
13:24:19.783 [print] 5ca627bf3edd851238e59c9e
所以你的变量id
是"5ca627bf3edd851238e59c9e"
5ca627bf3edd851238e59c9e
推荐阅读
- javascript - 如何制作 JS if 语句来查看值是否不是某些字符串?
- python - 哪个模块管理多个树中的节点?
- ios - 使用 performBatchUpdates 同时删除行、删除部分和重新加载行时 UITableView 崩溃
- c# - 我正在尝试将记录插入到对象列表中,但是当我调用该方法时没有插入任何内容。我究竟做错了什么?
- python - 如何在熊猫列表中打印值==字符串的行
- pandas - 使用时间序列列名操作列时出现熊猫键错误
- c++ - 如何在 C++ 中获取要更新的值
- pandas - 寻找一种使用应用函数将列添加到数据框的有效方法
- orbeon - 如何在 Orbeon 表单 CE 中为时间输入字段创建下拉列表
- r - 跨两个向量查找不匹配位置,包括 NA