0
API呼び出しが新しく、正しく動作するCreateおよびUpdateメソッドを記述していますが、ステータスは204ですがアイテムを削除しないDeleteAsync呼び出しです。リクエストパラメータは"FieldsOfBusiness/13158?Code=%27555%27"
のようなものです。私はあなたがサーバーの制御またはどのようにそれが応答していないよ推測しているポストマンDeleteAsyncの返された状態は204ですが、アイテムは削除されていません
public async Task<bool> DeleteAsync<T>(object id, NameValueCollection parameters)
{
var queryString = ToQueryString(parameters);
HttpResponseMessage response = await Client.DeleteAsync($"{GetName<T>()}/{id}{queryString}")
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();
var a = await response.Content.ReadAsAsync<T>();
return response.IsSuccessStatusCode;
}
protected string ToQueryString(NameValueCollection nvc)
{
if (nvc == null || nvc.Count < 1)
return string.Empty;
var array = (from key in nvc.AllKeys
from value in nvc.GetValues(key)
select string.Format("{0}={1}", HttpUtility.UrlEncode(key), HttpUtility.UrlEncode(value)))
.ToArray();
return "?" + string.Join("&", array);
}
動作すると、200または204が得られますか? –
@ SeanO'Neil私は204 – aj12
を参照してくださいこの[https://stackoverflow.com/questions/29545861/what-is-the-http-status-return-code-for-a-successful-delete-statement-in-残り](https://stackoverflow.com/questions/29545861/what-is-the-http-status-return-code-for-a-successful-delete-statement-in-rest) –