Creating and sending an HttpResponse message
16:07 25 Oct 2013

Given either a url or a HttpResponse instance, I need to send back a HttpResponse (note Response not Request) with Status code 200. I've tried a generic HttpClient.PostAsync and GetAsync, but I can't configure the status code.

This is basically a handshake for subscribing to events for a remote service. I send a Request, get an OK back from the server and now it's expecting me to reply to the OK with my own OK.

Any ideas on how to go about this? I don't have an incoming request to respond to.

var resp = new HttpResponseMessage(HttpStatusCode.OK);
// need to sent this to the url. no content necessary.

Here's some things I cannot do:

var client = new HttpClient();
var resp = await client.GetAsync(url);
-------------------
var content = new ByteArrayContent(new byte[0]);
var client = new HttpClient();
var resp = await client.PostAsync(url, content);
c# httpresponse