2 回答

TA贡献1825条经验 获得超6个赞
AadHttpClient支持该fetch(url, configuration, options)方法,其中options可以包含Fetch API支持的所有请求配置选项。
因此,要发出 DELETE 请求,您将执行以下操作:
client
.get(
`MY_API_URL/SOME_ROUTE`,
AadHttpClient.configurations.v1,
{
method: 'DELETE'
}
);

TA贡献1818条经验 获得超7个赞
我现在解决了。也许我的回答以后会对某人有所帮助。根据 philippe Signoret 的回答,这是 fetch() 函数。我不得不像下面这样使用它:
this.context.aadHttpClientFactory
.getClient(api_url)
.then((client: AadHttpClient) => {
return client
.fetch(
MY_URL,
AadHttpClient.configurations.v1,
{
method: METHOD, //put/DELETE etc.
headers: [
["Content-Type", "application/json"]
],
body: JSON.stringify({
YOUR REQUEST BODY
})
}
)
});
添加回答
举报