Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix running the web UI with class defined hosts #1956

merged 1 commit into from
Dec 9, 2021


Copy link

@chaen chaen commented Dec 9, 2021

I have the use case of two clients, each defining host as a class attribute. When running with --headless, it works fine, but when running with the UI, I kept getting errors like

[2021-12-09 14:32:00,340] localhost.localdomain/ERROR/locust.user.task: Invalid URL '/index.html': No schema supplied. Perhaps you meant http:///index.html?                    
Traceback (most recent call last):                                                                                                                                                            
  File "/home/chaen/miniconda3/envs/diracprod/lib/python3.9/site-packages/locust/user/", line 296, in run                                                                 
  File "/home/chaen/miniconda3/envs/diracprod/lib/python3.9/site-packages/locust/user/", line 321, in execute_next_task
  File "/home/chaen/miniconda3/envs/diracprod/lib/python3.9/site-packages/locust/user/", line 434, in execute_task
  File "/home/chaen/dirac/diracScaleTests/", line 15, in hello_world
  File "/home/chaen/miniconda3/envs/diracprod/lib/python3.9/site-packages/requests/", line 555, in get
    return self.request('GET', url, **kwargs)
  File "/home/chaen/miniconda3/envs/diracprod/lib/python3.9/site-packages/locust/", line 128, in request
    response = self._send_request_safe_mode(method, url, **kwargs)
  File "/home/chaen/miniconda3/envs/diracprod/lib/python3.9/site-packages/locust/", line 195, in _send_request_safe_mode
    return super().request(method, url, **kwargs)
  File "/home/chaen/miniconda3/envs/diracprod/lib/python3.9/site-packages/requests/", line 528, in request
    prep = self.prepare_request(req)
  File "/home/chaen/miniconda3/envs/diracprod/lib/python3.9/site-packages/requests/", line 456, in prepare_request
  File "/home/chaen/miniconda3/envs/diracprod/lib/python3.9/site-packages/requests/", line 316, in prepare
    self.prepare_url(url, params)
  File "/home/chaen/miniconda3/envs/diracprod/lib/python3.9/site-packages/requests/", line 390, in prepare_url
    raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL '/index.html': No schema supplied. Perhaps you meant http:///index.html?

This is because the web UI returns '' as host when left empty (as opposed to None that the code expected).

I changed the test conditions for overwriting the values, and added a test

@cyberw cyberw merged commit ec11ca4 into locustio:master Dec 9, 2021
Copy link

cyberw commented Dec 9, 2021


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants