1

I have an API which it's URL requires a string with spaces --> A B C I have tried

String X = "A B C";
vars.put("myKey",X);

GET  https://myserver.com/Api/v1.0/config/${myKey}   

When JMeter executes this it replaces spaces with %20 in url. I do not want JMeter to repalces spaces with %20, how can I do that

GET https://myserver.com/Api/v1.0/config/A%20B%20C
Ori Marko
  • 56,308
  • 23
  • 131
  • 233
Ghost
  • 549
  • 8
  • 29

2 Answers2

2

You can't send space in URL:

A URL must not contain a literal space. It must either be encoded using the percent-encoding or a different encoding that uses URL-safe characters (like application/x-www-form-urlencoded that uses + instead of %20 for spaces).

But you can use + instead of space

And notice that server/receiving end will decode it back to spaces so there isn't a real issue.

Community
  • 1
  • 1
Ori Marko
  • 56,308
  • 23
  • 131
  • 233
1

Usually browser replaces spaces entered into the address bar with %20. So do JMeter.

You have to update your API, so URL param with %20 should be interpreted as a string with a space(s) by your API.

Vadim Yangunaev
  • 1,817
  • 1
  • 18
  • 41