tauri2中报错Unhandled Promise Rejection: url not allowed on the configured scope: 配置可用请求scope

533 阅读1分钟

使用tauri-plugin-http请求报错:

url not allowed on the configured scope

Unhandled Promise Rejection: url not allowed on the configured scope: 

这是因为没有配置可以使用的域名,要在Capability文件夹中配置:

        {
            "identifier": "http:default",
            "allow": [{ "url": "https://**" }]
        }

Capability是tauri2独有的权限配置: 

配置好之后重新启动就可以了