Skip to content

Commit b908a07

Browse files
committed
test: make CoreSchemaRegistry test green again
`http://json.schemastore.org/tslint` has moved permanently to `https://json.schemastore.org/tslint` which is causing this test to fail
1 parent ebd5cbc commit b908a07

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/angular_devkit/core/src/json/schema/registry.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88
import * as ajv from 'ajv';
99
import * as http from 'http';
10+
import * as https from 'https';
1011
import { Observable, from, isObservable, of, throwError } from 'rxjs';
1112
import { concatMap, map, switchMap, tap } from 'rxjs/operators';
1213
import * as Url from 'url';
@@ -144,7 +145,9 @@ export class CoreSchemaRegistry implements SchemaRegistry {
144145

145146
// If none are found, handle using http client.
146147
return new Promise<JsonObject>((resolve, reject) => {
147-
http.get(uri, res => {
148+
const url = new Url.URL(uri);
149+
const client = url.protocol === 'https:' ? https : http;
150+
client.get(url, res => {
148151
if (!res.statusCode || res.statusCode >= 300) {
149152
// Consume the rest of the data to free memory.
150153
res.resume();

packages/angular_devkit/core/src/json/schema/registry_spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('CoreSchemaRegistry', () => {
3030
},
3131
},
3232
tslint: {
33-
$ref: 'http://json.schemastore.org/tslint#',
33+
$ref: 'https://json.schemastore.org/tslint#',
3434
},
3535
},
3636
})

0 commit comments

Comments
 (0)