Skip to content

Conversation

kristapratico
Copy link
Owner

No description provided.

if "/deployments" in str(self.base_url.path) and url not in _deployments_endpoints:
merge_url = httpx.URL(url)
if merge_url.is_relative_url:
merge_path = f"{self.base_url.path.rsplit('/deployments', maxsplit=1)[0]}/{merge_url.path.lstrip('/')}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than adding it and then removing it, did we consider adding it only when needed?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that would be the better way of dealing with it. However, we'd have to change the current value of client.base_url to take that approach which could break users.

Copy link
Collaborator

@johanste johanste Jun 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we split on/find '/deployments/'? I guess it is unlikely that one would name a deployment "deployments" (and we do a maxsplit=1 so it is only a problem if we have a deployments "to the right" of the intended split point).

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, the base_url property enforces a trailing slash so it will always be there, regardless of whether the user added it.

Copy link

@deyaaeldeen deyaaeldeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!



@pytest.mark.parametrize(
"client,base_url,api_path,json_data,expected",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can come up with a couple of additional tests here - e.g. have a dns name with deployments in it, add a deployment called deployments, add a couple of deployments to the azure_endpoint url etc.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants