зеркало из https://github.com/Azure/ms-rest-js.git
Ensure that a primitive type (string, number, boolean, null, undefined) response body with or without a `bodyMapper` is not flattened.
This commit is contained in:
Родитель
401b56e557
Коммит
096687b544
|
@ -1,4 +1,7 @@
|
|||
# Changelog
|
||||
## 2.0.4 - 2019-07-30
|
||||
- Ensure that a primitive type (string, number, boolean, null, undefined) response body with or without a `bodyMapper` is not flattened.
|
||||
|
||||
## 2.0.3 - 2019-07-11
|
||||
- Added support to not send default values while sending the request.
|
||||
- Added support to populate entities with it's default value if it is present in the mapper while deserializing the response.
|
||||
|
|
|
@ -576,7 +576,7 @@ export function flattenResponse(_response: HttpOperationResponse, responseSpec:
|
|||
}
|
||||
}
|
||||
|
||||
if (bodyMapper || _response.request.method === "HEAD") {
|
||||
if (bodyMapper || _response.request.method === "HEAD" || utils.isPrimitiveType(_response.parsedBody)) {
|
||||
// primitive body types and HEAD booleans
|
||||
return addOperationResponse({
|
||||
...parsedHeaders,
|
||||
|
|
|
@ -7,7 +7,7 @@ export const Constants = {
|
|||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
msRestVersion: "2.0.3",
|
||||
msRestVersion: "2.0.4",
|
||||
|
||||
/**
|
||||
* Specifies HTTP.
|
||||
|
|
|
@ -249,3 +249,13 @@ export function isDuration(value: string): boolean {
|
|||
export function replaceAll(value: string | undefined, searchValue: string, replaceValue: string): string | undefined {
|
||||
return !value || !searchValue ? value : value.split(searchValue).join(replaceValue || "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the given enity is a basic/primitive type
|
||||
* (string, number, boolean, null, undefined).
|
||||
* @param value Any entity
|
||||
* @return boolean - true is it is primitive type, false otherwise.
|
||||
*/
|
||||
export function isPrimitiveType(value: any): boolean {
|
||||
return (typeof value !== "object" && typeof value !== "function") || value === null;
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
"email": "azsdkteam@microsoft.com",
|
||||
"url": "https://github.com/Azure/ms-rest-js"
|
||||
},
|
||||
"version": "2.0.3",
|
||||
"version": "2.0.4",
|
||||
"description": "Isomorphic client Runtime for Typescript/node.js/browser javascript client libraries generated using AutoRest",
|
||||
"tags": [
|
||||
"isomorphic",
|
||||
|
|
Загрузка…
Ссылка в новой задаче