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
})
}
)
});
添加回答
舉報