使用空手道框架执行API测试时观察到的DNS错误
在通过Karat执行API进行呼叫时,请在评论代理时观察DNS错误,但是如果我使用代理,则会返回401错误。
以下是以下代码:
功能文件代码:
Background:
*url baseUrl
*def someData = { user:'"myemailid"','ContentType':'application/json',"Accept": "*/*"}
*headers someData
Scenario: SomeScenario
Given path '/clients'
When method GET
Then status 200
Karate Config :
function()
{
karate.configure('proxy','ip address')
var config = {
baseUrl:'some url'
}
return config;
}
请求发送到服务器: debug com.intuit.karate-请求:
1 > GET url
1 > Accept: */*
1 > Accept-Encoding: gzip,deflate
1 > Content-Type: application/json
1 > Host: scrbmapdk007182:8080
1 > Proxy-Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.5 (Java/1.8.0_141)
1 > user: "myemail"
响应是502,与DNS错误一起
不确定我在哪里出错,因为它通过Postman工作。Requestsend与Postman相同
While performing a get call for an api via karat observing DNS error when the proxies im using is commented but if i use the proxy it returns 401 error.
Below is the Following Code :
Feature File Code :
Background:
*url baseUrl
*def someData = { user:'"myemailid"','ContentType':'application/json',"Accept": "*/*"}
*headers someData
Scenario: SomeScenario
Given path '/clients'
When method GET
Then status 200
Karate Config :
function()
{
karate.configure('proxy','ip address')
var config = {
baseUrl:'some url'
}
return config;
}
Request Send to the server:
DEBUG com.intuit.karate - request:
1 > GET url
1 > Accept: */*
1 > Accept-Encoding: gzip,deflate
1 > Content-Type: application/json
1 > Host: scrbmapdk007182:8080
1 > Proxy-Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.5 (Java/1.8.0_141)
1 > user: "myemail"
Response is 502 with along with DNS error
Not sure where im going wrong because it is working via postman .Request send is same as in postman
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
阅读文档: https://github.com/intuit/karate#configure
必须是在
http中:
或https:
uri表单,包括端口号(如果适用),包括:编辑:对于其他降落在此处的其他地方,除了http代理可能在图片中 - 另一个地方空手道的行为与邮递员的行为有所不同。代码>接受默认情况下的标题。
Read the docs: https://github.com/intuit/karate#configure
Has to be in
http:
orhttps:
URI form including port number if applicable:EDIT: for others landing here, besides the fact that an HTTP proxy may be in the picture - another place where Karate behaves a bit differently than Postman is that Karate does not auto-send an
Accept
header by default.