c# - How To Set Headers For DeleteAsync -


i'm trying set custom headers on httpclient.deleteasync request. i've tried using

httpclient.defaultrequestheaders.add("x-parse-application-id",parseappid); 

but error

misused header name. make sure request headers used httprequestmessage, response headers httpresponsemessage, , content headers httpcontent objects. 

httpclient.sendasync can send custom request headers with

system.net.http.httprequestmessage.headers.add("x-parse-application-id",parseappid); 

and httpclient.postasync can send them with

system.net.http.stringcontent.headers.add("x-parse-application-id",parseappid); 

how can deleteasync?

instantiate httprequestmessage , use sendasync instead:

var request = new httprequestmessage(httpmethod.delete, requesturi); request.headers.add("x-parse-application-id", parseappid);  using (var response = await _calendarclient.sendasync(request).configureawait(false)) {     if (response.statuscode.equals(httpstatuscode.notfound))     {         return;     }     response.ensuresuccessstatuscode(); } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -