-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Description
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 responseThe 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
swagger-editor/app/scripts/directives/tryoperation.js
Lines 585 to 597 in 98794c3
| 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.
osvald-laurits