karatelabs / karate

Test Automation Made Simple

Home Page:https://karatelabs.github.io/karate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The request "path" can not be overwrited in mock.feature

tdhanjun opened this issue · comments

I tried to use karate.proceed to "transition" the api to new Url with "Proxy mode".

But i see the request path can not overwrite.

What I tried is like this:

testScenario.feature

Scenario: test mock

    * url 'http://localhost:' + port + '/v1/hello/metoto'
    * param name = 'lily'
    * param age = 11
    * method get

mock.feature

    Scenario: pathMatches('/{version}/{say}/{name}')

    * def requestHeaders = { 'Authorization': 'Bearer 123'}
    * def requestParams = {}
    * def requestPath = '/'
    * def newurl = 'https://jsonplaceholder.typicode.com'
    * karate.proceed(newurl)

The requestHeaders and requestParams can be overwritten correctly, but the requestPath would encounter the issue :

09:23:25.412 [armeria-common-worker-kqueue-3-4] DEBUG c.intuit.karate.core.ScenarioEngine - over-writing existing variable 'requestHeaders' with new value: { 'Authorization': 'Bearer 123'}
09:23:25.413 [armeria-common-worker-kqueue-3-4] DEBUG c.intuit.karate.core.ScenarioEngine - over-writing existing variable 'requestParams' with new value: {name: ['John'], age: ['60']}
09:23:25.425 [armeria-common-worker-kqueue-3-4] ERROR com.intuit.karate - server-side scenario failed, /Users/metoto/karate_test/karate_training/src/test/java/support/utils/mock.feature:51
* def requestPath ='/'
no step-definition method match found for: def requestPath ='/'

I'm not sure if something is wrong in my code. or is this an issue?