Skip to content

Commit

Permalink
fix: 修复swagger接口文档中schema不正确的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
liqiang-fit2cloud committed Nov 13, 2024
1 parent 4a043cf commit 6f84239
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions apps/common/config/swagger_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ def get_tags(self, operation_keys=None):
if "api" in tags and operation_keys:
return [tags_dict.get(operation_keys[1]) if operation_keys[1] in tags_dict else operation_keys[1]]
return tags
def get_schema(self, request=None, public=False):
schema = super().get_schema(request, public)
if request.is_secure():
schema.schemes = ['https']
else:
schema.schemes = ['http']
return schema
2 changes: 2 additions & 0 deletions apps/smartdoc/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
'default': CONFIG.get_db_setting()
}

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

# Application definition

INSTALLED_APPS = [
Expand Down

0 comments on commit 6f84239

Please sign in to comment.