Nuxt 3
$fetch
函数似乎有30秒超时,我找不到延长它的方法。有没有办法延长超时限制?
示例:
// server/api/render.ts
...
var startTime = performance.now();
try {
const output = await $fetch(config.MODEL_ENDPOINT_URL + "/render", {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify(input),
});
} catch (error) {
console.log(error)
var endTime = performance.now();
console.log(
"Execution time: " + (endTime - startTime) / 1000 // Throws error after exactly 30 seconds.
);
}
...
在 oFetch 1.2 中实现并用作
timeout
选项。 Nuxt 3.7正在使用它!