Skip to content

Commit

Permalink
fix: correctly use sources fetch options
Browse files Browse the repository at this point in the history
Fixes #275
  • Loading branch information
harlan-zw committed May 6, 2024
1 parent e90aa82 commit 1506dc3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/runtime/nitro/sitemap/urlset/sources.ts
@@ -1,4 +1,5 @@
import type { FetchError } from 'ofetch'
import { defu } from 'defu'
import type {
ModuleRuntimeConfig,
SitemapSourceBase,
Expand All @@ -21,11 +22,12 @@ export async function fetchDataSource(input: SitemapSourceBase | SitemapSourceRe
let isHtmlResponse = false
try {
const urls = await globalThis.$fetch(url, {
...options,
responseType: 'json',
signal: timeoutController.signal,
headers: {
headers: defu(options?.headers, {
Accept: 'application/json',
},
}),
// @ts-expect-error untyped
onResponse({ response }) {
if (typeof response._data === 'string' && response._data.startsWith('<!DOCTYPE html>'))
Expand Down

0 comments on commit 1506dc3

Please sign in to comment.