Set user agent in cached-fetch request.
This makes the Google search suggestion API return charset=utf-8.
This commit is contained in:
parent
d75c361603
commit
891610ea7f
@ -12,7 +12,11 @@ export default async function cachedFetch(url, duration) {
|
|||||||
return cached;
|
return cached;
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await fetch(url).then((res) => res.json());
|
const data = await fetch(url, {
|
||||||
|
headers: {
|
||||||
|
"User-Agent": "Mozilla/5.0",
|
||||||
|
},
|
||||||
|
}).then((res) => res.json());
|
||||||
cache.put(url, data, duration * 1000 * 60);
|
cache.put(url, data, duration * 1000 * 60);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user