Skip to content

Accept-Language header parameter ignored in live request #470

@thomas-riccardi

Description

@thomas-riccardi
swagger: '2.0'

info:
  version: "0.0.0"
  title: Accept-Language header parameter ignored in live request

# Describe your paths here
paths:
  /:
    get:
      parameters:
        - name: Accept-Language
          in: header
          type: string
      responses:
        200:
          description: Successful response

The Accept-Language header parameter is ignored when using the live request feature of the editor: it sends Accept-Language: en-US,en;q=0.8,fa;q=0.6,sv;q=0.4.

Other headers are overridden too, see

var defaultHeaders = {
Host: host,
Accept: $scope.accepts || '*/*',
'Accept-Encoding': 'gzip,deflate,sdch', //TODO: where this is coming from?
'Accept-Language': 'en-US,en;q=0.8,fa;q=0.6,sv;q=0.4', // TODO: wut?
'Cache-Control': 'no-cache',
Connection: 'keep-alive',
Origin: window.location.origin,
Referer: window.location.origin + window.location.pathname,
'User-Agent': window.navigator.userAgent
};
headerParams = _.extend(headerParams, defaultHeaders);

_.extend() erases headers from swagger spec with "default" header values.
If we really want the "default" headers to be default values, _.defaults() should be used instead.

However, maybe some headers should be overridden instead of just having default value, or maybe not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions