fix: Take host into account when extracting identifier

This commit is contained in:
Joachim Van Herwegen
2020-07-10 14:17:10 +02:00
parent 792323797d
commit cff9790b6e
4 changed files with 34 additions and 11 deletions

View File

@@ -12,6 +12,11 @@ describe('A SimpleTargetExtractor', (): void => {
});
it('returns the input URL.', async(): Promise<void> => {
await expect(extractor.handle({ url: 'url' } as any)).resolves.toEqual({ path: 'url' });
await expect(extractor.handle({ url: 'url', headers: { host: 'test.com' }} as any)).resolves.toEqual({ path: 'http://test.com/url' });
});
it('uses https protocol if the connection is secure.', async(): Promise<void> => {
await expect(extractor.handle({ url: 'url', headers: { host: 'test.com' }, connection: { encrypted: true } as any } as any))
.resolves.toEqual({ path: 'https://test.com/url' });
});
});