Skip to content

Commit b7160a0

Browse files
committed
Fix how pending after upstream headers appears
Previously we didn't differentiate this case from aborted downstream, which resulted in very weird UX, where the request appeared as pending the view list, but aborted when selected. This mainly applies to long-polling streams, where headers come back but no body until events arrive (e.g. ntfy.sh). This will be fixed better in future body streaming changes (already done in Mockttp, but not yet active in the UI) so this is just a quick fix for now.
1 parent 8ae0782 commit b7160a0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/model/http/upstream-exchange.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,10 @@ export class UpstreamHttpExchange extends HttpExchangeViewBase implements HttpEx
164164
if (this.upstreamResponseData === 'aborted') {
165165
return 'aborted';
166166
} else if (downstreamRes === 'aborted' || !downstreamRes) {
167-
// Downstream was aborted, so upstream data (if any) is all we have
167+
// Downstream is aborted or pending, so upstream data (if any) is all we have
168+
169+
if (downstreamRes && !this.wasResponseTransformed) return 'aborted';
168170

169-
if (!this.wasResponseTransformed) return 'aborted';
170171
const { statusCode, statusMessage, rawHeaders, body } = this.upstreamResponseData as
171172
Required<typeof this.upstreamResponseData>; // If downstream is aborted, upstream data is complete
172173

0 commit comments

Comments
 (0)