Skip to content

刷新swagger-ui 后 Authorize 会失效 #214

Open
@Xuguozong

Description

@Xuguozong

上传文件接口测试的时候,如果先在swagger-ui中选定文件,再在编辑器或其他软件中修改了文件内容并保存,然后再测试接口会有 TypeError: Failed to fetch 的错误,这时就需要刷新swagger-ui,刷新了swagger-ui后配置的token方式的Authorize就失效了。看了提供的配置项好像不能解决这个问题。

  1. swagger 配置:
    swagger:
    enabled: true
    title:xxxxx
    description:
    version: xxxxx
    contact.name: xxxxxx
    base-package: xxxxxx
    base-path: /api/,/rest/
    exclude-path: /error, /ops/**
    authorization:
    name: Authorization # 鉴权策略ID,对应 SecurityReferences ID
    type: ApiKey # 鉴权策略,可选 ApiKey | BasicAuth | None,默认ApiKey
    key-name: token # 鉴权传递的Header参数

  2. swagger-spring-boot-starter 版本:1.9.1.RELEASE

  3. Rest 层
    @PostMapping("/excel/import")
    public Rimport(@RequestParam("uploadFile") MultipartFile file) {
    checkUploadFile(file, ".xlsx");
    return new R<>(xxxService.doImport(currentUser(), file));
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions