@@ -32,7 +32,6 @@ import { createOpportunityData } from './opportunity-data-mapper.js';
32
32
const auditType = Audit . AUDIT_TYPES . SITEMAP ;
33
33
// Add new constant for status codes we want to track
34
34
const TRACKED_STATUS_CODES = Object . freeze ( [ 301 , 302 , 404 ] ) ;
35
- const DEFAULT_USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36' ;
36
35
37
36
export const ERROR_CODES = Object . freeze ( {
38
37
INVALID_URL : 'INVALID URL' ,
@@ -67,9 +66,6 @@ const VALID_MIME_TYPES = Object.freeze([
67
66
export async function fetchContent ( targetUrl ) {
68
67
const response = await fetch ( targetUrl , {
69
68
method : 'GET' ,
70
- headers : {
71
- 'User-Agent' : DEFAULT_USER_AGENT ,
72
- } ,
73
69
} ) ;
74
70
if ( ! response . ok ) {
75
71
throw new Error ( `Fetch error for ${ targetUrl } Status: ${ response . status } ` ) ;
@@ -188,9 +184,6 @@ export async function filterValidUrls(urls) {
188
184
const response = await fetch ( url , {
189
185
method : 'HEAD' ,
190
186
redirect : 'manual' ,
191
- headers : {
192
- 'User-Agent' : DEFAULT_USER_AGENT ,
193
- } ,
194
187
} ) ;
195
188
196
189
if ( response . status === 200 ) {
@@ -205,9 +198,6 @@ export async function filterValidUrls(urls) {
205
198
const redirectResponse = await fetch ( finalUrl , {
206
199
method : 'HEAD' ,
207
200
redirect : 'follow' ,
208
- headers : {
209
- 'User-Agent' : DEFAULT_USER_AGENT ,
210
- } ,
211
201
} ) ;
212
202
return {
213
203
status : NOT_OK ,
@@ -608,7 +598,7 @@ export async function opportunityAndSuggestions(auditUrl, auditData, context) {
608
598
609
599
export default new AuditBuilder ( )
610
600
. withRunner ( sitemapAuditRunner )
611
- . withUrlResolver ( ( site ) => composeAuditURL ( site . getBaseURL ( ) , DEFAULT_USER_AGENT )
601
+ . withUrlResolver ( ( site ) => composeAuditURL ( site . getBaseURL ( ) )
612
602
. then ( ( url ) => getUrlWithoutPath ( prependSchema ( url ) ) ) )
613
603
. withPostProcessors ( [ generateSuggestions , opportunityAndSuggestions ] )
614
604
. build ( ) ;
0 commit comments