Skip to content

GraphRandomErrorPlugin throws on HEAD, OPTIONS and other methods #1955

Closed

Description

@waldekmastykarz

Description

_methodStatusCode only has entries for GET, POST, PUT, PATCH and DELETE. For any other method (HEAD, OPTIONS, …), the lookup _methodStatusCode[method] throws KeyNotFoundException.

Code:

  • private readonly Dictionary<string, HttpStatusCode[]> _methodStatusCode = new()
    {
    {
    "GET", new[] {
    HttpStatusCode.TooManyRequests,
    HttpStatusCode.InternalServerError,
    HttpStatusCode.BadGateway,
    HttpStatusCode.ServiceUnavailable,
    HttpStatusCode.GatewayTimeout
    }
    },
    {
    "POST", new[] {
    HttpStatusCode.TooManyRequests,
    HttpStatusCode.InternalServerError,
    HttpStatusCode.BadGateway,
    HttpStatusCode.ServiceUnavailable,
    HttpStatusCode.GatewayTimeout,
    HttpStatusCode.InsufficientStorage
    }
    },
    {
    "PUT", new[] {
    HttpStatusCode.TooManyRequests,
    HttpStatusCode.InternalServerError,
    HttpStatusCode.BadGateway,
    HttpStatusCode.ServiceUnavailable,
    HttpStatusCode.GatewayTimeout,
    HttpStatusCode.InsufficientStorage
    }
    },
    {
    "PATCH", new[] {
    HttpStatusCode.TooManyRequests,
    HttpStatusCode.InternalServerError,
    HttpStatusCode.BadGateway,
    HttpStatusCode.ServiceUnavailable,
    HttpStatusCode.GatewayTimeout
    }
    },
    {
    "DELETE", new[] {
    HttpStatusCode.TooManyRequests,
    HttpStatusCode.InternalServerError,
    HttpStatusCode.BadGateway,
    HttpStatusCode.ServiceUnavailable,
    HttpStatusCode.GatewayTimeout,
    HttpStatusCode.InsufficientStorage
    }
    }
    };
  • var methodStatusCodes = _methodStatusCode[e.ProxySession.Request.Method];
  • var methodStatusCodes = _methodStatusCode[request.Method];

Expected behavior

Requests with other methods either pass through or get a generic error, without an exception.

Activity

  1. waldekmastykarz commented on Oct 21, 2026

    @waldekmastykarz
    CollaboratorAuthor

    Fixed by #1990: methods with no allowed error codes, including methods missing from the built-in list such as HEAD and OPTIONS, now pass through. This issue will close when that PR merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions