Inspection

Live on this server

Shows what the server received and responded, to debug clients.

InspectionSample.cs34 lines
using GenHTTP.Api.Content;

using GenHTTP.Modules.Functional;
using GenHTTP.Modules.Inspection;
using GenHTTP.Modules.Layouting;

public static class InspectionSample
{

    public static IHandlerBuilder Create()
    {
        /*
         *
         * Helps to find out why a client receives a certain response. Append "?inspect"
         * to any URL to see the request as the server received it, together with
         * the response the server would have sent.
         *
         * As this exposes details about your server, only add it while developing.
         *
         * See https://genhttp.org/documentation/content/concerns/inspection/
         *
         */

        var orders = Inline.Create()
                           .Get((int limit) => Enumerable.Range(1, limit).Select(i => new Order(i)));

        return Layout.Create()
                     .Add("api/orders", orders) // GET /samples/inspection/api/orders/?limit=5&inspect
                     .AddInspector();
    }

    public record Order(int Id);

}

Try it

Send the requests to the sample running on this server - change the path, headers or body as you like, or copy them as curl commands.

  1. Call the API

    GET
    curl -i 'https://genhttp.org/samples/inspection/api/orders/?limit=5'
  2. Inspect the call

    GET
    curl -i 'https://genhttp.org/samples/inspection/api/orders/?limit=5&inspect'