Skip to content

Commit

Permalink
Fix forbidden response for websockets
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexMacocian committed Aug 11, 2024
1 parent 14d7444 commit 5ca1ba3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion GuildWarsPartySearch/Endpoints/PostPartySearch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ public override async Task SocketAccepted(CancellationToken cancellationToken)

public override async Task SocketClosed()
{
var scopedLogger = this.logger.CreateScopedLogger(nameof(this.SocketClosed), string.Empty);
if (this.Context?.Items.TryGetValue(UserAgentRequired.UserAgentKey, out var userAgentValue) is not true ||
userAgentValue is not string userAgent)
{
throw new InvalidOperationException("Unable to extract user agent on client disconnect");
scopedLogger.LogDebug("No user agent found. A connection has been rejected");
return;
}

if (!await this.botStatusService.RemoveBot(userAgent, CancellationToken.None))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ private static async Task BeginProcessingPipeline(ActionExecutingContext actionE
}

await filter.OnActionExecutionAsync(actionExecutingContext, next);
await (actionExecutingContext.Result?.ExecuteResultAsync(actionExecutingContext) ?? Task.CompletedTask);
return actionExecutedContext;
};
}
Expand Down

0 comments on commit 5ca1ba3

Please sign in to comment.