Search code examples
c#swagger-uiswashbuckle

Show HTTP request duration in Swagger UI


Swagger UI has the displayRequestDuration parameter to show how long a request takes. It's disabled by default.

How can this be enabled in the SwaggerConfig.cs configuration when using Swashbuckle (the not-core version)?

I see this is possible in the Java version.


Solution

  • In recent versions you can do

    app.UseSwaggerUi3(
        settings => settings.AdditionalSettings.Add("displayRequestDuration ", true));
    )
    
    

    since app.UseSwaggerUI is marked as obsolete.

    Tested with .NET Core 3.x.