You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[core-http] use response status to determine whether body is stream (Azure#13192)
Our current code has the incorrect assumption that if any body mapper
of an operation spec is of `Stream` type then response body must be a
stream and `httpRequest.streamResponseBody` is set according to this
assumption. However, Storage issue Azure#12997 shows that the default
response of Download Blob operation does not have a stream body with
the following operation spec:
```typescript
responses: {
200: {
bodyMapper: {
serializedName: "parsedResponse",
type: {
name: "Stream"
}
},
headersMapper: Mappers.BlobDownloadHeaders
},
...
default: {
bodyMapper: Mappers.StorageError,
headersMapper: Mappers.BlobDownloadHeaders
}
},
```
Treating response body as stream in the default case prevent us from
parsing the body which leads to missing `code` and `message` from the
error object.
This change fixes the issue by actually checking the body type of the
response corresponding to the response status code.
WebResource{Like}.streamResponseBody is deprecated
because a boolean value is not enough to determine whether a response
is streaming or not. A list of streaming response status code
`streamResponseStatusCodes` is introduced and used instead.
ServiceClient no longer sets the deprecated
`streamResponsebody` property based on incorrect assumption. However
we still respect `streamResponseBody` in case it's set by users.
Core v2 removes `streamResponseBody`.
0 commit comments