Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requestInterceptor and responseInterceptor may not be quoted #753

Merged
merged 1 commit into from
Mar 23, 2021

Conversation

tisoft
Copy link
Contributor

@tisoft tisoft commented Mar 19, 2021

requestInterceptor and responseInterceptor need to be functions, so they may not be quoted

requestInterceptor and responseInterceptor need to be functions, so they may not be quoted
@tisoft
Copy link
Contributor Author

tisoft commented Mar 19, 2021

I tried to set the request-interceptor in quarkus:

quarkus.swagger-ui.request-interceptor=req => {console.log(req);return req;}

This was rendered as:

requestInterceptor: 'req => {console.log(req);return req;}',

Which does not work, as a real funtion is expected:

Fetch error
n.requestInterceptor is not a function /q/openapi

@tisoft
Copy link
Contributor Author

tisoft commented Mar 19, 2021

Just for reference, setting the on complete function via quarkus works:

quarkus.swagger-ui.on-complete=req => {console.log('lala');return req;}

This prints lala on the console on page load.

onComplete: ${onComplete},

is not quoted in the template.

@tisoft
Copy link
Contributor Author

tisoft commented Mar 22, 2021

If anyone needs a workaround, until this is merged:

quarkus.swagger-ui.on-complete=function() {ui.getConfigs().requestInterceptor=req => {if(req.body){req.body=req.body.replaceAll('\\n','\\r');};return req;}}

Since the on-complete function can be set, you can set the requestInterceptor inside the onComplete.

@phillip-kruger phillip-kruger merged commit 2f04702 into smallrye:main Mar 23, 2021
@phillip-kruger
Copy link
Member

Thanks !

@phillip-kruger phillip-kruger added this to the 2.1.3 milestone Mar 23, 2021
@tisoft tisoft deleted the patch-1 branch March 25, 2021 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants