Skip to content

Commit cd627a3

Browse files
authored
Only send Authorization header if token is present
Previously it would send "Authorization: Bearer null" when no token was present
1 parent 34f6c1b commit cd627a3

File tree

1 file changed

+3
-2
lines changed
  • aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Host/wwwroot/swagger/ui

1 file changed

+3
-2
lines changed

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Host/wwwroot/swagger/ui/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@
7979
configObject.presets = [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset];
8080
configObject.layout = "StandaloneLayout";
8181
configObject.requestInterceptor = function (request) {
82-
request.headers.Authorization = "Bearer " + abp.auth.getToken();
82+
var token = abp.auth.getToken();
83+
request.headers.Authorization = token ? "Bearer " + token : null;
8384
return request;
8485
};
8586
if (!configObject.hasOwnProperty("oauth2RedirectUrl")) {
@@ -129,4 +130,4 @@
129130
</script>
130131
</body>
131132

132-
</html>
133+
</html>

0 commit comments

Comments
 (0)