Skip to content

Chrome overrides User-Agent specified as parameter #5035

@pikazlou

Description

@pikazlou

Q&A (please complete the following information)

  • OS: macOS
  • Browser: chrome
  • Browser Version: 70.0.3538.77
  • Method of installation: dist assets
  • Swagger-UI version: 3.19.5
  • Swagger/OpenAPI version: Swagger 2.0

Content & configuration

Example Swagger/OpenAPI definition:

      - name: "User-Agent"
        in: "header"
        description: "user agent"
        required: true
        type: "string"
        default: "CustomAgent"

Swagger-UI configuration options:

    window.onload = function() {
      // Begin Swagger UI call region
      const ui = SwaggerUIBundle({
        url: "swagger.yaml",
        dom_id: '#swagger-ui',
        deepLinking: true,
        presets: [
          SwaggerUIBundle.presets.apis,
          SwaggerUIStandalonePreset
        ],
        plugins: [
          SwaggerUIBundle.plugins.DownloadUrl
        ],
        layout: "StandaloneLayout"
      })
      // End Swagger UI call region

      window.ui = ui
    }

Describe the bug you're encountering

Browser always overrides User-Agent header and sends its own, no matter what value I type into parameter

To reproduce...

Steps to reproduce the behavior:

  1. Go to method with User-Agent parameter
  2. Click on Execute

Expected behavior

Request is sent with User-Agent equal to specified parameter

Actual behavior

Request is sent with standard browser User-Agent

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions