Skip to content

Commit

Permalink
Bring back the workaround of uppercasing method names as that is requ…
Browse files Browse the repository at this point in the history
…ired for storage data plane library
  • Loading branch information
amarzavery committed Jun 6, 2019
1 parent 4273b51 commit bbeb122
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.8.12 - 2019-06-07
- Added back the workaround of uppercasing method names otherwise axios causes issues with signing requests for storage data plane libraries.

## 1.8.11 - 2019-06-06
- Moved testing dependent projects from a script to Azure Devops Pipeline

## 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.
Expand Down
10 changes: 9 additions & 1 deletion lib/axiosHttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,15 @@ export class AxiosHttpClient implements HttpClient {
config.httpAgent = agent.agent;
}
}

// This hack is still required with 0.19.0 version of axios since axios tries to merge the
// Content-Type header from it's config["<method name>"] where the method name is lower-case,
// into the request header. It could be possible that the Content-Type header is not present
// in the original request and this would create problems while creating the signature for
// storage data plane sdks.
axios.interceptors.request.use((config: AxiosRequestConfig) => ({
...config,
method: (config.method as Method) && (config.method as Method).toUpperCase() as Method
}));
res = await axios.request(config);
} catch (err) {
if (err instanceof axios.Cancel) {
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.11",
msRestVersion: "1.8.12",

/**
* 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.11",
"version": "1.8.12",
"description": "Isomorphic client Runtime for Typescript/node.js/browser javascript client libraries generated using AutoRest",
"tags": [
"isomorphic",
Expand Down

0 comments on commit bbeb122

Please sign in to comment.