0

I want to pass a parameter value like foldername/filestarting_xyz as a parameter but when I pass like below

And param paramname = foldername/filestarting_xyz

It's taking like the url amended like foldername%2Ffilestarting_xyz and erroring out

If I use%2F instead of / then it's amending as%252F.

Can you please help me how to pass value for parameters that as slash / in karate

This is related to param

KK12
  • 61
  • 6

1 Answers1

-1

Maybe you have confused param with path so please read this: https://stackoverflow.com/a/69723043/143475

Otherwise this is the expected behavior: https://stackoverflow.com/a/54477346/143475

EDIT: If you want "proof" that Karate is doing the right thing, try this 3 line test.

* url 'https://httpbin.org/anything'
* param foo = 'one/two'
* method get

And see how the server processes it correctly (look at the response):

1 > GET https://httpbin.org/anything?foo=one%2Ftwo
1 > Host: httpbin.org
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.13)
1 > Accept-Encoding: gzip,deflate


20:32:08.757 [main] DEBUG com.intuit.karate - response time in milliseconds: 1576
1 < 200
1 < Date: Mon, 01 Nov 2021 15:02:08 GMT
1 < Content-Type: application/json
1 < Content-Length: 425
1 < Connection: keep-alive
1 < Server: gunicorn/19.9.0
1 < Access-Control-Allow-Origin: *
1 < Access-Control-Allow-Credentials: true
{
  "args": {
    "foo": "one/two"
  } 
}
Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • No my requirement is passing slash in param only – KK12 Nov 01 '21 at 12:36
  • Can you please help with passing slash in param.. One of my query parameter fetch a file from a folder that's the requirement... So the value of param should be folder/filename – KK12 Nov 01 '21 at 13:11
  • @KK12 see my edit. that is how HTTP works and I am giving you proof. if your server cannot handle `%2F` - it is a bug. you are welcome to look for another framework, please assume that what you want is not supported in karate. – Peter Thomas Nov 01 '21 at 15:04