Skip to content

Commit

Permalink
Merge pull request #358 from amarzavery/axiosFix
Browse files Browse the repository at this point in the history
Set tranformResponse property of axios req. config to an identity function
  • Loading branch information
amarzavery authored Jun 4, 2019
2 parents 7997723 + 73d900b commit 8c76e21
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 1.8.10 - 2019-06-05
- `axios` changed the way it treats properties of the request config in `0.19.0`. Previously we were setting `trasnformResponse` to `undefined`. This would indicate `axios` to not transform (`JSON.parse()`) the response body. In `0.19.0`, they are setting the default response transformer if transformResponse is set to `undefined`. This breaks our pasrsing logic where we are doing `JSON.parse()` on `operationResponse.bodyAsText`. Moreover, we are exposing the `bodyAsText` property in the generated clients.
Not populating this property or setting the value of this property to a parsed JSON would be a breaking change for our users.
Hence we are setting the `transformResponse` property in the request config to an indentity function that returns the response body as-is.

## 1.8.9 - 2019-06-04
- Added build job to CI pipeline

## 1.8.8 - 2019-06-03
- Fixed vulnerabilities by bumping `axios` to `^0.19.0`.
- New version of axios fixed some issues hence removed one of the workarounds of uppercasing method names while following redirects [axios PR](https://github.com/axios/axios/pull/1758).
Expand Down
2 changes: 1 addition & 1 deletion lib/axiosHttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class AxiosHttpClient implements HttpClient {
url: httpRequest.url,
headers: rawHeaders,
data: axiosBody,
transformResponse: undefined,
transformResponse: (data) => { return data; },
validateStatus: () => true,
// Workaround for https://github.com/axios/axios/issues/1362
maxContentLength: Infinity,
Expand Down
2 changes: 1 addition & 1 deletion lib/util/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const Constants = {
* @const
* @type {string}
*/
msRestVersion: "1.8.8",
msRestVersion: "1.8.10",

/**
* Specifies HTTP.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"email": "azsdkteam@microsoft.com",
"url": "https://github.com/Azure/ms-rest-js"
},
"version": "1.8.9",
"version": "1.8.10",
"description": "Isomorphic client Runtime for Typescript/node.js/browser javascript client libraries generated using AutoRest",
"tags": [
"isomorphic",
Expand Down

0 comments on commit 8c76e21

Please sign in to comment.