Skip to content

Conversation

@meixnerlu
Copy link
Contributor

@meixnerlu meixnerlu commented Jul 15, 2025

Fixes #279


I added the option for query parameters to the RequestLike interface and the httpRequest function.
I added the query with service and scope to be send on the token request.
I ran the lint and test commands.

@meixnerlu
Copy link
Contributor Author

@microsoft-github-policy-service agree

@meixnerlu meixnerlu marked this pull request as ready for review July 15, 2025 22:43
@meixnerlu meixnerlu requested a review from a team as a code owner July 15, 2025 22:43
@meixnerlu
Copy link
Contributor Author

I'm unsure on whether I should add to the changelog while others have open PRs with changes to it.

@bwateratmsft bwateratmsft changed the title meixnerlu/docker_auth_add_query Add service and scope to query params in addition to headers Jul 16, 2025
Copy link
Collaborator

@bwateratmsft bwateratmsft left a comment

Choose a reason for hiding this comment

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

I think your approach is good (honestly--probably better than what I did originally), but it goes against the pattern for setting the query params that we use in a few other places in this package. I should probably refactor it later towards your pattern, but for now I'd prefer to keep it consistent with the others. Can you change it to match the pattern below?

Here you can see it being set:

let requestUrl: vscode.Uri | undefined = DockerHubRequestUrl
.with({ path: `v2/repositories/${registry.label}` })
.with({ query: pageSizeQuery });

And here's how that pageSizeQuery is defined:

const pageSizeQuery = new URLSearchParams({ page_size: '100' }).toString();

In the toString for your resultant vscode.Uri, don't forget to pass true, otherwise it gets overencoded.

@meixnerlu
Copy link
Contributor Author

This looks good but im unsure where you want it implemented. Do you want it implemented for httpRequest or in the function calling it

@bwateratmsft
Copy link
Collaborator

I was thinking in the caller of httpRequest.

Copy link
Collaborator

@bwateratmsft bwateratmsft left a comment

Choose a reason for hiding this comment

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

Looks good. I'll try to test it out this week.

@bwateratmsft bwateratmsft merged commit b790be0 into microsoft:main Jul 31, 2025
2 checks passed
@bwateratmsft
Copy link
Collaborator

Merged, thanks for the contribution @meixnerlu! I'm going to bump the package version and changelog and get it ready to release. Then I'll integrate it into vscode-containers, and it should go out in the upcoming 2.2.0 release.

@meixnerlu
Copy link
Contributor Author

Thanks its been fun :)

@meixnerlu meixnerlu deleted the meixnerlu/docker_auth_add_query branch August 1, 2025 23:29
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.

Potential spec mismatch: BasicOAuthProvider sends service & scope as headers instead of query params

2 participants