- This project is a super-lightweight web API.
- It is invoked by the demos.
flowchart LR
console{{PollyTestClientConsole}}
wpf{{PollyTestClientWPF}}
lib>PollyDemos]
api[/PollyTestWebApi\]
style api stroke:#0f0
console -- uses --> lib
wpf -- uses --> lib
lib -- invokes --> api
- It exposes several simple endpoints.
- All of them echo back the received parameter (
{id}
) with some hard-coded prefixes.
- It simply returns a string.
- It is decorated with rate limiting.
- It allows 3 requests per 5 seconds.
- If the threshold is exceeded then it returns an HTTP 429 status code.
- It simply returns a string.
- As its name suggests, it is not decorated with rate limiting.
- It waits 5 seconds before returning a string.
- It emulates slow processing.
- As its name suggests, it is not decorated with rate limiting.
- It waits 1 second +/- several milliseconds before returning a string.
- It emulates varying response processing.
- It is not decorated with rate limiting.
- It waits half a second (optionally +/- several milliseconds) before returning a response.
- It emulates varying response status codes.
- It is not decorated with rate limiting.
- The
Controllers/ValueController.cs
- contains the definition of the
/api/Values/{id}
endpoint - decorated with the rate limiting policy
- contains the definition of the
- The
Program.cs
contains the majority of the codebase- the rate limiting policy definition
- the controllers registration
- and it exposes the rest of the endpoints via Minimal API
- From the
PollySamples
directory:
dotnet run --project PollyTestWebApi/PollyTestWebApi.csproj
- From the
PollyTestWebApi
directory:
dotnet run
- The web API will be hosted with Kestrel with
http://localhost:45179
as the base URL.