Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions rubberduckvba.Server/Api/Admin/WebhookController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ public WebhookController(

[Authorize("webhook")]
[HttpPost("webhook/github")]
public async Task<IActionResult> GitHub([FromBody] object body)
public async Task<IActionResult> GitHub()
{
var json = body.ToString();
var payload = JsonSerializer.Deserialize<PushWebhookPayload>(json, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
var reader = new StreamReader(Request.Body);
var json = await reader.ReadToEndAsync();

var payload = JsonSerializer.Deserialize<PushWebhookPayload>(json, new JsonSerializerOptions { PropertyNameCaseInsensitive = true })
?? throw new InvalidOperationException("Could not deserialize payload");
var eventType = _validator.Validate(payload, json, Request.Headers, out var content, out var gitref);

if (eventType == WebhookPayloadType.Push)
Expand Down