Skip to content
This repository was archived by the owner on Mar 11, 2022. It is now read-only.

Commit 60140aa

Browse files
committed
Check for valid response object before resuming data feed.
1 parent e44b588 commit 60140aa

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# UNRELEASED
22
- [NEW] Added option for client to authenticate with IAM token server.
3+
- [FIXED] Case where `.resume()` was called on an undefined response.
34

45
# 3.0.2 (2019-01-07)
56
- [FIXED] Remove unnecessary `@types/nano` dependancy.

lib/clientutils.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,16 @@ var processState = function(r, callback) {
108108
return;
109109
}
110110

111-
// pass response events/data to awaiting client
112-
if (r.eventRelay) {
113-
r.eventRelay.resume();
114-
}
115-
if (r.clientStream.destinations.length > 0) {
116-
r.response.pipe(r.clientStream.passThroughReadable);
111+
if (r.response) {
112+
// pass response events/data to awaiting client
113+
if (r.eventRelay) {
114+
r.eventRelay.resume();
115+
}
116+
if (r.clientStream.destinations.length > 0) {
117+
r.response.pipe(r.clientStream.passThroughReadable);
118+
}
119+
r.response.resume();
117120
}
118-
r.response.resume();
119121

120122
// [5] => Return response to awaiting client.
121123
callback(new Error('No retry requested')); // no retry

0 commit comments

Comments
 (0)