本文介紹了獲取錯(cuò)誤http請(qǐng)求失敗:在空手道中使用路徑時(shí)為空的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
我開始使用空手道進(jìn)行測(cè)試,但當(dāng)我使用”Path”關(guān)鍵字時(shí),我收到”http請(qǐng)求失敗:空”錯(cuò)誤。
當(dāng)使用以下方案時(shí),它可以工作:
Feature: items
Scenario: Testing /items response status
Given url appBaseUrl + '/items'
And param param1 = 1
And param param2 = 10
When method get
Then status 200
但是,當(dāng)我嘗試使用以下代碼中的”Path”關(guān)鍵字時(shí),我得到了錯(cuò)誤
Feature: items
Scenario: Testing /items response status
Given url appBaseUrl
And path 'items'
And param param1 = 1
And param param2 = 10
When method get
Then status 200
items.feature:8 - null
com.intuit.karate.exception.KarateException: items.feature:8 - null
at ?.When method GET (items.feature:8)
我不知道我做錯(cuò)了什么。是否還有其他步驟需要完成,而我遺漏了?
推薦答案
一定有其他原因,因?yàn)檫@應(yīng)該會(huì)起作用。例如,請(qǐng)嘗試以下操作:
* def appBaseUrl = 'http://httpbin.org/anything'
Given url appBaseUrl
And path 'items'
And param param1 = 1
And param param2 = 10
When method get
Then status 200
在我的系統(tǒng)上運(yùn)行正常。
所以我建議您遵循以下流程:https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
編輯:這確實(shí)是一個(gè)錯(cuò)誤:https://github.com/intuit/karate/issues/760-使用karate-jersey
是一種解決方法,直到修復(fù)
這篇關(guān)于獲取錯(cuò)誤http請(qǐng)求失敗:在空手道中使用路徑時(shí)為空的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,