Validation response for CloudEvents in ASP.NET Core Web API
[HttpOptions] | |
public async Task<IActionResult> Options() | |
{ | |
using (var reader = new StreamReader(Request.Body, Encoding.UTF8)) | |
{ | |
// Retrieve the validation header fields | |
var webhookRequestOrigin = HttpContext.Request.Headers["WebHook-Request-Origin"].FirstOrDefault(); | |
var webhookRequestCallback = HttpContext.Request.Headers["WebHook-Request-Callback"]; | |
var webhookRequestRate = HttpContext.Request.Headers["WebHook-Request-Rate"]; | |
// Respond with the appropriate origin and allowed rate to | |
// confirm acceptance of incoming notications | |
HttpContext.Response.Headers.Add("WebHook-Allowed-Rate", "*"); | |
HttpContext.Response.Headers.Add("WebHook-Allowed-Origin", webhookRequestOrigin); | |
} | |
return Ok(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment