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

[Perf Framework] Use urljoin to concatenate URLs #20899

Merged
merged 3 commits into from
Oct 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import aiohttp

from urllib.parse import urljoin
from ._policies import PerfTestProxyPolicy


Expand Down Expand Up @@ -67,7 +68,7 @@ async def stop_playback(self):
"x-recording-id": self._recording_id,
"x-purge-inmemory-recording": "true"
}
url = self.args.test_proxy + "/playback/stop"
url = urljoin(self.args.test_proxy, "/playback/stop")
mikeharder marked this conversation as resolved.
Show resolved Hide resolved
async with self._session.post(url, headers=headers) as resp:
assert resp.status == 200

Expand All @@ -91,20 +92,20 @@ async def run_async(self):
raise Exception("run_async must be implemented for {}".format(self.__class__.__name__))

async def _start_recording(self):
url = self.args.test_proxy + "/record/start"
url = urljoin(self.args.test_proxy, "/record/start")
async with self._session.post(url) as resp:
assert resp.status == 200
self._recording_id = resp.headers["x-recording-id"]

async def _stop_recording(self):
headers = {"x-recording-id": self._recording_id}
url = self.args.test_proxy + "/record/stop"
url = urljoin(self.args.test_proxy, "/record/stop")
async with self._session.post(url, headers=headers) as resp:
assert resp.status == 200

async def _start_playback(self):
headers = {"x-recording-id": self._recording_id}
url = self.args.test_proxy + "/playback/start"
url = urljoin(self.args.test_proxy, "/playback/start")
async with self._session.post(url, headers=headers) as resp:
assert resp.status == 200
self._recording_id = resp.headers["x-recording-id"]
Expand Down