Skip to content

Refresh the browser each time, the global header is added in duplicate. #1820

Closed
@doljae

Description

@doljae

Describe the bug

  • Refresh the browser each time, the global header is added in duplicate.

To Reproduce
Steps to reproduce the behavior:

SwaggerConfiguration.kt

@Configuration
class SwaggerConfiguration {

    @Bean
    fun globalHeaders(): OpenApiCustomiser = OpenApiCustomiser { openApi ->
        openApi.paths.flatMap { it.value.readOperations() }
            .forEach {
                it.addParametersItem(HeaderParameter().name("Header1").required(true))
                it.addParametersItem(HeaderParameter().name("Header2").required(true))
            }
    }
}

Expected behavior

  • When I refresh the browser, it works properly without any duplicated headers.

Screenshots

After running Spring Boot application

image

Refresh browser once

image

Refresh browser twice

image

Additional context

  • Disabling the cache through the properties below does not cause duplicate headers.
springdoc.cache.disabled= true
  • I wonder if this is intended or if the configuration is wrong.

  • When I debug the code, it seems that AbstractOpenApiResource 's OpenApiCustomizer logic is related. If it's a bug, I want to send a PR after fixing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions