后端
2.20.5- 若设置
$options._res.status, 拉取文件时将设置自定义响应状态码举例: 请求来自分享且 ua 不符合时, 返回自定义状态码和响应内容
const { headers, url, path } = $options?._req || {}
const ua = headers?.['user-agent'] || headers?.['User-Agent']
if (/^\/share\//.test(url) && !/surge/i.test(ua)) {
$options._res = {
status: 418
}
$content = `I'm a teapot`
}- 👍6
- ❤️1