Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/utils/src/internals/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ export async function* discoverValidSitemaps(
const urlExists = async (url: string) => {
const response = await gotScraping({
url,
method: 'HEAD',
method: 'GET',
proxyUrl,
timeout: {
request: requestTimeoutMillis,
Expand Down
44 changes: 22 additions & 22 deletions packages/utils/test/sitemap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,13 +464,13 @@ describe('discoverValidSitemaps', () => {
nock('http://sitemap-discovery.com')
.get('/robots.txt')
.reply(200, 'Sitemap: http://sitemap-discovery.com/some-sitemap.xml')
.head('/some-sitemap.xml')
.get('/some-sitemap.xml')
.reply(200, '')
.head('/sitemap.xml')
.get('/sitemap.xml')
.reply(404, '')
.head('/sitemap.txt')
.get('/sitemap.txt')
.reply(404, '')
.head('/sitemap_index.xml')
.get('/sitemap_index.xml')
.reply(404, '');

const urls = [];
Expand All @@ -485,11 +485,11 @@ describe('discoverValidSitemaps', () => {
nock('http://sitemap-discovery.com')
.get('/robots.txt')
.reply(404)
.head('/sitemap.xml')
.get('/sitemap.xml')
.reply(200, '')
.head('/sitemap.txt')
.get('/sitemap.txt')
.reply(404, '')
.head('/sitemap_index.xml')
.get('/sitemap_index.xml')
.reply(404, '');

const urls = [];
Expand All @@ -504,11 +504,11 @@ describe('discoverValidSitemaps', () => {
nock('http://sitemap-discovery.com')
.get('/robots.txt')
.reply(404)
.head('/sitemap.xml')
.get('/sitemap.xml')
.reply(404, '')
.head('/sitemap.txt')
.get('/sitemap.txt')
.reply(200, '')
.head('/sitemap_index.xml')
.get('/sitemap_index.xml')
.reply(404, '');

const urls = [];
Expand All @@ -523,11 +523,11 @@ describe('discoverValidSitemaps', () => {
nock('http://sitemap-discovery.com')
.get('/robots.txt')
.reply(404)
.head('/sitemap.xml')
.get('/sitemap.xml')
.reply(404, '')
.head('/sitemap.txt')
.get('/sitemap.txt')
.reply(404, '')
.head('/sitemap_index.xml')
.get('/sitemap_index.xml')
.reply(200, '');

const urls = [];
Expand All @@ -554,26 +554,26 @@ describe('discoverValidSitemaps', () => {
.get('/robots.txt')
.delay(10)
.reply(404)
.head('/sitemap.xml')
.get('/sitemap.xml')
.delay(30)
.reply(200, '')
.head('/sitemap.txt')
.get('/sitemap.txt')
.delay(50)
.reply(200, '')
.head('/sitemap_index.xml')
.get('/sitemap_index.xml')
.reply(404);

nock('http://domain-b.com')
.get('/robots.txt')
.delay(20)
.reply(404)
.head('/sitemap.xml')
.get('/sitemap.xml')
.delay(40)
.reply(200, '')
.head('/sitemap.txt')
.get('/sitemap.txt')
.delay(60)
.reply(200, '')
.head('/sitemap_index.xml')
.get('/sitemap_index.xml')
.reply(404);

const urls = [];
Expand Down Expand Up @@ -654,11 +654,11 @@ describe('discoverValidSitemaps', () => {
.get('/robots.txt')
.delay(5_000)
.reply(200, 'Sitemap: http://slow-site.com/sitemap.xml')
.head('/sitemap.xml')
.get('/sitemap.xml')
.reply(200, '')
.head('/sitemap.txt')
.get('/sitemap.txt')
.reply(404, '')
.head('/sitemap_index.xml')
.get('/sitemap_index.xml')
.reply(404, '');

const start = Date.now();
Expand Down