Skip to content

Commit

Permalink
Eliminate query parameter from RegistryV2RequestOptions (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwateratmsft authored Jan 8, 2025
1 parent ac9703e commit d8d90e9
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions packages/vscode-docker-registries/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.2.0 - 7 January 2025
### Fixed
* Fixes an issue that would cause infinite looping on registries that used paging in tags listing. [#243](https://github.com/microsoft/vscode-docker-extensibility/issues/243)
* The above required a breaking alteration to the `RegistryV2RequestOptions` interface.

## 0.1.13 - 17 December 2024
### Fixed
* Fixed 404 when exploring and pulling GHCR images. [#238](https://github.com/microsoft/vscode-docker-extensibility/issues/238)
Expand Down
2 changes: 1 addition & 1 deletion packages/vscode-docker-registries/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@microsoft/vscode-docker-registries",
"author": "Microsoft Corporation",
"version": "0.1.13",
"version": "0.2.0",
"description": "Extensibility model for contributing registry providers to the Docker extension for Visual Studio Code",
"license": "See LICENSE in the project root for license information.",
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,7 @@ export class GitHubRegistryDataProvider extends RegistryV2DataProvider {
const catalogResponse = await registryV2Request<{ repositories: string[] }>({
authenticationProvider: this.authenticationProvider,
method: 'GET',
requestUri: requestUrl,
query: {
n: '100',
last: nextSearchString
},
requestUri: requestUrl.with({ query: new URLSearchParams({ n: '100', last: nextSearchString }).toString() }),
scopes: ['registry:catalog:*'],
throwOnFailure: true,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export abstract class RegistryV2DataProvider extends CommonRegistryDataProvider
authenticationProvider: this.getAuthenticationProvider(registry),
method: 'GET',
requestUri: nextLink,
query: Object.fromEntries(new URLSearchParams(nextLink.query)),
scopes: ['registry:catalog:*'],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { HttpErrorResponse } from '../../utils/errors';
export interface RegistryV2RequestOptions {
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
requestUri: vscode.Uri;
query?: Record<string, string>;
scopes: string[];
headers?: Record<string, string>;
throwOnFailure?: boolean;
Expand Down Expand Up @@ -45,9 +44,6 @@ export async function registryV2Request<T>(options: RegistryV2RequestOptions): P
}

async function registryV2RequestInternal<T>(options: RegistryV2RequestOptions): Promise<RegistryV2Response<T>> {
const query = new URLSearchParams(options.query);
const uri = options.requestUri.with({ query: query.toString() });

const auth = await options.authenticationProvider.getSession(options.scopes, options.sessionOptions);

const request: RequestLike = {
Expand All @@ -59,13 +55,13 @@ async function registryV2RequestInternal<T>(options: RegistryV2RequestOptions):
method: options.method,
};

const response = await httpRequest(uri.toString(true), request, options.throwOnFailure);
const response = await httpRequest(options.requestUri.toString(true), request, options.throwOnFailure);

return {
status: response.status,
statusText: response.statusText,
succeeded: response.succeeded,
uri: uri,
uri: options.requestUri,
headers: response.headers,
body: response.succeeded && (parseInt(response.headers.get('content-length') ?? '0') || response.headers.get('transfer-encoding') === 'chunked') ? await response.json() as T : undefined,
};
Expand Down

0 comments on commit d8d90e9

Please sign in to comment.