蝗虫给予“ httperror(404客户端错误:未找到url:

发布于 2025-02-07 16:33:18 字数 536 浏览 1 评论 0原文

我有一个React Web应用程序,我想在这2个URL上使用蝗虫对其进行负载测试。 (主页&隐私政策页面)。对于主页,它可以正常工作,但是对于隐私页面,它给出了“ httperror('404客户端错误:找不到网址:https:// xxx/privacy-policy/')”错误。当我在浏览器上击中这些URL时,既可以打开&没有任何错误。为什么蝗虫给出这个错误。

这是我的代码 -

    import time
    from locust import HttpUser, task, constant

    class CreateLead(HttpUser):
    host = "https://xxx"
    wait_time = constant(0)

   @task
   def loadtest(self):
       self.client.get("/")
       time.sleep(1)

       self.client.get("/privacy-policy")
       time.sleep(1)

I have a react web application, i want to do load testing on it using locust, on these 2 URL. (Homepage & Privacy Policy page). for homepage, it is working but for privacy page, it is giving "HTTPError('404 Client Error: Not Found for url: https://xxx/privacy-policy/') " error. when I am hitting these URL on browser both URL open & not giving any error. Why Locust giving this error.

this is my code -

    import time
    from locust import HttpUser, task, constant

    class CreateLead(HttpUser):
    host = "https://xxx"
    wait_time = constant(0)

   @task
   def loadtest(self):
       self.client.get("/")
       time.sleep(1)

       self.client.get("/privacy-policy")
       time.sleep(1)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文