Error when two consecutive forward slashes in url are needed

Hi everyone, I’m facing a problem when I try to make a simulation on a url with 2 consecutive slashes. I need that because an technical issue in server routing, so I end up with a url like “https://www.server.com/page//images/image1.jpg” (url does not work if I remove a slash between “page” and “images”). The problem is that, apparently, gatling is removing one of those slashes and converts my url to “https://www.server.com/page/images/image1.jpg”. does anyone know if exists a workaround to fix it?? Thanks!!

As of now, Gatling uses normalized uri. From the RFC perspective, these 2 should be equivalent. I’m not sure your workaround for your routing issue is correct.

system.out.println(URI.create("https://www.server.com/page//images/image1.jpg").normalize());
// prints https://www.server.com/page/images/image1.jpg

Changing this would be a behavior change. In particular, I’m thinking of all the users who have a trailing / in their baseUrl and a leading one in their requests.

Thanks Stephane! Yes, I know that the server is not following the standards and that’s wrong, but I just wanted to know if there was another way to solve it from gatling without making changes in the server to test which is difficult for me. But it’s ok, from your answer now 'm sure that changing the server is the only way.
Thanks for your prompt response!!!

I’ve quickly checked what Chrome does and it doesn’t behave exactly the same way as URI#normalize:

  • https://www.server.com/page//images/image1.jpg is not transformed => different
  • https://www.server.com/page/../images/image1.jpg is transformed into https://www.server.com/images/image1.jpg => same

But I’m afraid of changing Gatling’s behavior and breaking existing tests.

Ok, I understand. No problem, I’m gonna promote making changes in our server. So , in summary, this is the code that gatling executes, isn’t it?: URI.create(“https://www.server.com/page//images/image1.jpg”).normalize()

Thanks!

Basically, yes.

Cheers

Great. Thanks! so much!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.