Skip to content
Snippets Groups Projects
Unverified Commit c4bb98ab authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

feat(dart): allow custom registryUrls (#25987)

parent 2bc92018
Branches
Tags
No related merge requests found
......@@ -3,7 +3,7 @@
exports[`modules/datasource/dart/index getReleases processes real data 1`] = `
{
"homepage": "https://github.com/flutter/plugins/tree/master/packages/shared_preferences/shared_preferences",
"registryUrl": "https://pub.dartlang.org/",
"registryUrl": "https://pub.dartlang.org",
"releases": [
{
"releaseTimestamp": "2017-05-09T18:25:24.268Z",
......
import type { HttpResponse } from '../../../util/http/types';
import { ensureTrailingSlash } from '../../../util/url';
import { Datasource } from '../datasource';
import type { GetReleasesConfig, ReleaseResult } from '../types';
import type { DartResult } from './types';
......@@ -10,7 +11,7 @@ export class DartDatasource extends Datasource {
super(DartDatasource.id);
}
override readonly customRegistrySupport = false;
override readonly customRegistrySupport = true;
override readonly defaultRegistryUrls = ['https://pub.dartlang.org/'];
......@@ -23,7 +24,9 @@ export class DartDatasource extends Datasource {
return null;
}
let result: ReleaseResult | null = null;
const pkgUrl = `${registryUrl}api/packages/${packageName}`;
const pkgUrl = `${ensureTrailingSlash(
registryUrl,
)}api/packages/${packageName}`;
let raw: HttpResponse<DartResult> | null = null;
try {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment