1

Getting java.net.URISyntaxException: Illegal character error when we pass '{' in one of the query parameters for "GET" request.

Example : Try : http://127.0.0.1:8090/mock-server/Test/v1/address/validate?address=Test{Test}

mahesh
  • 61
  • 1
  • 2

1 Answers1

0

Try this example:

* url 'https://httpbin.org'
* path 'anything'
* param address = "Test{Test}"
* method get

And you will see Karate make this request:

1 > GET https://httpbin.org/anything?address=Test%7BTest%7D
1 > Host: httpbin.org
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_231)
1 > Accept-Encoding: gzip,deflate

And get this kind of response:

17:43:08.896 [main] DEBUG com.intuit.karate - response time in milliseconds: 1204
1 < 200
1 < Date: Tue, 13 Apr 2021 12:13:08 GMT
1 < Content-Type: application/json
1 < Content-Length: 440
1 < Connection: keep-alive
1 < Server: gunicorn/19.9.0
1 < Access-Control-Allow-Origin: *
1 < Access-Control-Allow-Credentials: true
{"args":{"address":"Test{Test}"},"headers":""}

And you can see Test{Test} was sent correctly.

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248