Hello,
I am working on a scenario to test one of our products. It basically is a React webapp, with a Java Spring backend.
The first page is a login page, containing a BotDetect Captcha. Url for the page is http : // 127.0.0.1:8080 / myContext/pages/identification.
The captcha is loaded through a fragment of html, with a specific url : http : // 127.0.0.1:8080 / myContext/simple-captcha-endpoint?get=html&c=identElecteurCaptchaFr
It contains references to sound and reload icons for the captcha :
<img class="BDC_ReloadIcon" id="identElecteurCaptchaFr_ReloadIcon" src="../includes/election/images/botdetect_refresh_32.png" alt="Recharger le code du Captcha" />
<img class="BDC_SoundIcon" id="identElecteurCaptchaFr_SoundIcon" src="../includes/admin/images/botdetect_speaker_32.png" alt="Écouter le code du Captcha" />
In browser, this fragment is integrated in the page, and both icons urls are relative to current page url, i.e.
http : // 127.0.0.1:8080 / myContext/includes/election/images/botdetect_refresh_32.png and http :// 127.0.0.1:8080 / myContext/includes/admin/images/botdetect_speaker_32.png
Images load fine, and it is the expected behaviour.
However, when I make the request to the html fragment from Gatling :
http("Captcha fragment Get")
.get("/simple-captcha-endpoint?get=html&c=identElecteurCaptchaFr")
.header("X-XSRF-TOKEN", "${xsrfToken}")
.check(substring("BDC_CaptchaImageDiv"))
.check(Check.captchaId)
.check(status.is(Constants.successStatus))
I receive 404 errors for both images, because I suppose their URL is relative to the html fragment url, and not the parent page url. They are missing myContext because of the “…” in their src in the fragment.
http : //127.0.0.1:8080 / includes/election/images/botdetect_refresh_32.png
http : //127.0.0.1:8080 / includes/admin/images/botdetect_speaker_32.png
The easiest solution would be to ignore 404s for this call, but I don’t like it. You guys have another idea about how to deal with this case?
Thanks!