You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the basic configuration it is possible to request swagger documents with incorrect extensions. I believe the following tests will fail (I haven't had the change to test this yet on the swashbuckle codebase):
[Theory]
[InlineData(typeof(Basic.Startup), "/swagger/v1/swagger.jsonxxx")]
[InlineData(typeof(Basic.Startup), "/swagger/v1/swagger.yamlxxx")]
[InlineData(typeof(Basic.Startup), "/swagger/v1/swagger.txt")]
public async Task SwaggerEndpoint_ReturnsValidSwaggerJson(
Type startupType,
string swaggerRequestUri)
{
var testSite = new TestSite(startupType);
var client = testSite.BuildClient();
var swaggerResponse = await client.GetAsync(swaggerRequestUri);
Assert.Equal(HttpStatusCode.NotFound, swaggerResponse.StatusCode);
}
Instead of returning 404 NotFound these will return the json document.
The reason for this seems to be that the patter "/swagger/{documentName}/swagger.{json|yaml}" doesn't actually perform an "or" on the extension, but will generate a route parameter with the name "json|yaml" for the above example the value for this parameter is either "jsonxxx", "yamlxxx" or "txt"
The text was updated successfully, but these errors were encountered:
With the basic configuration it is possible to request swagger documents with incorrect extensions. I believe the following tests will fail (I haven't had the change to test this yet on the swashbuckle codebase):
Instead of returning 404 NotFound these will return the json document.
The reason for this seems to be that the patter "/swagger/{documentName}/swagger.{json|yaml}" doesn't actually perform an "or" on the extension, but will generate a route parameter with the name "json|yaml" for the above example the value for this parameter is either "jsonxxx", "yamlxxx" or "txt"
The text was updated successfully, but these errors were encountered: