Skip to content

when response type is text and accept is text but response is json format, it will be json. #375

@jonashartwig

Description

@jonashartwig

axios version: 0.12.0

Request Headers:
GET /url HTTP/1.1
Host: localhost:4441
Connection: keep-alive
Accept: text/plain
Origin: http://localhost:1337
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
Referer: http://localhost:1337/en/archivedatastore/ejashig-ads-create-test-30
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,de;q=0.6,sv;q=0.4

Response Headers:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Access-Control-Allow-Origin: http://localhost:1337
Access-Control-Allow-Credentials: true
Content-Type: text/plain
Content-Length: 270
Date: Wed, 13 Jul 2016 07:04:51 GMT

axios request config:

{
"transformRequest": {},
"transformResponse": {},
"headers": {
"Accept": "text/plain"
},
"timeout": 0,
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
"maxContentLength": -1,
"method": "GET",
"responseType": "text",
"url": "http://localhost:4441/url"
}

server response:

{
"RTC_SERVICE_URL": "http://localhost:7776/rtc-service/",
"APP_SERVICE_URL": "http://localhost:7771/app-service/",
"ARCHIVE_SERVICE_URL": "http://localhost:4441/service/archive/",
"RAWDATA_DISPATCHER_URL": "http://localhost:7775/rawdata-dispatcher/"
}

what i would expect:

response.data is a string as all data types and accept header point to it (as well as the config). But actually response.data will be a json object. (observed in latest chrome)

regards

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