fix(ff): throw friendly message on fetching redirect body (#8594)

This commit is contained in:
Pavel Feldman 2021-08-31 12:11:32 -07:00 committed by GitHub
parent 74e6f2756a
commit 0e6620ce94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -418,7 +418,7 @@ export class Response extends SdkObject {
body(): Promise<Buffer> {
if (!this._contentPromise) {
this._contentPromise = this._finishedPromise.then(async () => {
if (this._request._redirectedTo)
if (this._status >= 300 && this._status <= 399)
throw new Error('Response body is unavailable for redirect responses');
return this._getResponseBodyCallback();
});