public virtual IActionResult PostEventToEndpointByUid([FromRoute] Guid endpointUid) { if (!EndpointManager.TryGetEndpointByUid(endpointUid, out EndpointInformation endpoint)) { Console.WriteLine($"Received message for unknown Endpoint: {endpointUid}"); // assume this endpoint has been removed return(StatusCode((int)HttpStatusCode.Gone)); } if (endpoint.Enabled == false) { Console.WriteLine($"Received message for DISABLED Endpoint: {endpointUid}, refusing!"); return(StatusCode((int)HttpStatusCode.Forbidden)); } Console.WriteLine($"Received message for Endpoint: {endpointUid}"); using (StreamReader reader = new StreamReader(Request.Body)) { string content = reader.ReadToEndAsync().Result; EndpointManager.QueueMessage(endpointUid, content); } return(StatusCode((int)HttpStatusCode.NoContent)); }
public virtual IActionResult PostEventToEndpointByUrlPart([FromRoute] string urlPart) { if (!EndpointManager.Exists(urlPart)) { Console.WriteLine($"Received message for unknown Endpoint Url: {urlPart}"); // assume this endpoint has been removed return(StatusCode((int)HttpStatusCode.Gone)); } Console.WriteLine($"Received message for Endpoint: {urlPart}"); using (StreamReader reader = new StreamReader(Request.Body)) { string content = reader.ReadToEnd(); EndpointManager.QueueMessage(urlPart, content); } return(StatusCode((int)HttpStatusCode.NoContent)); }