SetResponseStatusCode() public method

public SetResponseStatusCode ( HttpStatusCode status_code ) : void
status_code HttpStatusCode
return void
Beispiel #1
0
 private async Task OnStop(OWINEnv env, Dictionary<string, string> query, CancellationToken cancel_token)
 {
   var channel = FindChannelFromQuery(query);
   if (channel!=null) {
     Application.PeerCast.CloseChannel(channel);
     env.SetResponseStatusCode(HttpStatusCode.OK);
     await env.SetResponseBodyAsync("OK", cancel_token).ConfigureAwait(false);
   }
   else {
     env.SetResponseStatusCode(HttpStatusCode.NotFound);
     await env.SetResponseBodyAsync("Channel NotFound", cancel_token).ConfigureAwait(false);
   }
 }
Beispiel #2
0
 private async Task OnViewXML(OWINEnv env, Dictionary<string, string> query, CancellationToken cancel_token)
 {
   var data = BuildViewXml();
   env.SetResponseStatusCode(HttpStatusCode.OK);
   env.SetResponseHeader("Content-Type", "text/xml");
   env.SetResponseHeader("Content-Length", data.Length.ToString());
   if (env.RequestMethod!="HEAD") {
     await env.ResponseBody.WriteAsync(data, 0, data.Length, cancel_token).ConfigureAwait(false);
   }
 }
Beispiel #3
0
 private async Task OnStop(OWINEnv env, Dictionary<string, string> query, CancellationToken cancel_token)
 {
   var channel = FindChannelFromQuery(query);
   if (channel!=null) {
     Application.PeerCast.CloseChannel(channel);
     env.SetResponseStatusCode(HttpStatusCode.OK);
     await env.SetResponseBodyAsync("OK", cancel_token);
   }
   else {
     env.SetResponseStatusCode(HttpStatusCode.NotFound);
     await env.SetResponseBodyAsync("Channel NotFound", cancel_token);
   }
 }
Beispiel #4
0
 private async Task OnBump(OWINEnv env, Dictionary<string, string> query, CancellationToken cancel_token)
 {
   var channel = FindChannelFromQuery(query);
   if (channel!=null) {
     channel.Reconnect();
     env.SetResponseStatusCode(HttpStatusCode.OK);
     await env.SetResponseBodyAsync("OK", cancel_token);
   }
   else {
     env.SetResponseStatusCode(HttpStatusCode.NotFound);
     await env.SetResponseBodyAsync("Channel NotFound", cancel_token);
   }
 }
Beispiel #5
0
 private async Task OnViewXML(OWINEnv env, Dictionary<string, string> query, CancellationToken cancel_token)
 {
   var data = BuildViewXml();
   env.SetResponseStatusCode(HttpStatusCode.OK);
   env.SetResponseHeader("Content-Type", "text/xml");
   env.SetResponseHeader("Content-Length", data.Length.ToString());
   if (env.RequestMethod!="HEAD") {
     await env.ResponseBody.WriteAsync(data, 0, data.Length, cancel_token);
   }
 }