File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
springdoc-openapi-common/src/main/java/org/springdoc/ui Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -151,17 +151,16 @@ protected String defaultTransformations(InputStream inputStream) throws IOExcept
151
151
*/
152
152
protected String addCSRF (String html ) {
153
153
StringBuilder stringBuilder = new StringBuilder ();
154
- stringBuilder .append ("requestInterceptor: function() {\n " );
154
+ stringBuilder .append ("requestInterceptor: (request) => {\n " );
155
155
stringBuilder .append ("const value = `; ${document.cookie}`;\n " );
156
156
stringBuilder .append ("const parts = value.split(`; " );
157
157
stringBuilder .append (swaggerUiConfig .getCsrf ().getCookieName ());
158
158
stringBuilder .append ("=`);\n " );
159
- stringBuilder .append ("console.log(parts);\n " );
160
159
stringBuilder .append ("if (parts.length === 2)\n " );
161
- stringBuilder .append ("this .headers['" );
160
+ stringBuilder .append ("request .headers['" );
162
161
stringBuilder .append (swaggerUiConfig .getCsrf ().getHeaderName ());
163
162
stringBuilder .append ("'] = parts.pop().split(';').shift();\n " );
164
- stringBuilder .append ("return this ;\n " );
163
+ stringBuilder .append ("return request ;\n " );
165
164
stringBuilder .append ("},\n " );
166
165
stringBuilder .append ("presets: [" );
167
166
return html .replace ("presets: [" , stringBuilder .toString ());
You can’t perform that action at this time.
0 commit comments