-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Describe the bug
After the upgrade to 6.6.1, Request and Response interceptors are output to the document with the wrong property names (incorrect casing). They are expected to be written with initial uppercase letters, RequestInterceptorFunction and ResponseInterceptorFunction but are now being written as requestInterceptorFunction and responseInterceptorFunction. This causes them to longer function as expected (or rather, at all).
We rely on this functionality and missed this during the upgrade process as we were more focused on the document generation. We will need to roll back unless there's a workaround I'm not aware of
Expected behavior
The serialized functions should be output using the correct property names (or the expected property name in the index.html should be adjusted to reflect the new names) and should be invoked in response to requests/responses.
Actual behavior
Functions are serialized with incorrect names and no longer execute.
Steps to reproduce
Set a request or response interceptor:
services.Configure<SwaggerUIOptions>(s => s.UseRequestInterceptor("function(req) { return req; }"));
Previously this would produce the following:
var interceptors = JSON.parse('{"RequestInterceptorFunction":"function (req) { return req; }","ResponseInterceptorFunction":null}');
if (interceptors.RequestInterceptorFunction)
configObject.requestInterceptor = parseFunction(interceptors.RequestInterceptorFunction);
if (interceptors.ResponseInterceptorFunction)
configObject.responseInterceptor = parseFunction(interceptors.ResponseInterceptorFunction);With latest version (6.6.1) it produces this instead:
var interceptors = JSON.parse('{"requestInterceptorFunction":"function (req) { return req; }"}');
if (interceptors.RequestInterceptorFunction)
configObject.requestInterceptor = parseFunction(interceptors.RequestInterceptorFunction);
if (interceptors.ResponseInterceptorFunction)
configObject.responseInterceptor = parseFunction(interceptors.ResponseInterceptorFunction);Exception(s) (if any)
No response
Swashbuckle.AspNetCore version
6.6.1
.NET Version
net8.0
Anything else?
No response