-
Notifications
You must be signed in to change notification settings - Fork 11
Description
From a customer:
A potential improvement in request_rest.
Currently, if you pass a fully-qualified URL (like a downloadURL) to self.rest_client.get(...), it gets incorrectly prepended to the base URL — resulting in broken requests like:
https://app.useanvil.com/api/v1/https://app.useanvil.com/api/...
This behavior appears to come from logic that blindly joins self.get_url() with url, even when url is already complete.
To work around this, we’re currently using the internal client directly:
# Current workaround
byte_data = self.api_client.client.request(method="GET", url=download_url)
Ideally, we’d like to use the request_rest() interface:
# Desired usage (currently causes double-url issue)
byte_data = self.rest_client.get(url=download_url)
Also worth noting — it looks like request_rest() accepts an options object that doesn’t get used. It could be helpful to allow something like an absolute_url=True flag there (or an internal check for url.startswith("http")) to handle full URLs gracefully.