diff --git a/README.md b/README.md index 273d461..89dfccd 100755 --- a/README.md +++ b/README.md @@ -295,6 +295,10 @@ These are the available config options for making requests. Only the `url` is re // options are 'arraybuffer', 'blob', 'document', 'json', 'text', 'stream' responseType: 'json', // default + // `responseEncoding` indicates encoding to use for decoding responses + // Note: Ignored for `responseType` of 'stream' or client-side requests + responseEncoding: 'utf8', // default + // `xsrfCookieName` is the name of the cookie to use as a value for xsrf token xsrfCookieName: 'XSRF-TOKEN', // default diff --git a/lib/adapters/http.js b/lib/adapters/http.js index 0255d47..f081d49 100755 --- a/lib/adapters/http.js +++ b/lib/adapters/http.js @@ -198,7 +198,7 @@ module.exports = function httpAdapter(config) { stream.on('end', function handleStreamEnd() { var responseData = Buffer.concat(responseBuffer); if (config.responseType !== 'arraybuffer') { - responseData = responseData.toString('utf8'); + responseData = responseData.toString(config.responseEncoding); } response.data = responseData;