Skip to content
This repository was archived by the owner on Sep 23, 2020. It is now read-only.
This repository was archived by the owner on Sep 23, 2020. It is now read-only.

Validate ProxiedApiRouteEndpointLookup provided configuration dictionary #39

Description

@joaofbantunes

The current implementation of ProxiedApiRouteEndpointLookup does not validate its configuration conveniently, as it only verifies that the provided dictionary is not null.

As it is a requirement, we should enforce that the dictionary keys correspond to a valid url path, composed of a single segment (e.g. /some-segment) and the values are valid url's.

With that in mind, a good approach is probably to start by changing the types contained in the dictionary, to something that better denotes the contents, then add some extra validations in the constructor.

  1. Change the dictionary from Dictionary<string,string> to Dictionary<PathString,Uri>
  2. In the constructor, check that the keys, are PathStrings that contain a single segment
  3. In the constructor, check that the values are absolute uris (value.IsAbsoluteUri)
  4. With all the information in hand regarding the validity of the keys and values, if any invalid entry is found, throw an ArgumentException, including information about what caused it

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions