Skip to content

Commit 9af94d1

Browse files
committed
Show transform pill for modified requests, even on passthrough rules
This shouldn't really come up, but it does in some cases: some are bugs (currently h2c upgrades are turned into websocket upgrades, for example) and some are edge cases (if the client request is closed before the response is sent, but after the server response is received).
1 parent fef29bd commit 9af94d1

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/components/view/http/transform-card.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { styled } from '../../../styles';
66

77
import { ContentPerspective, UiStore } from '../../../model/ui/ui-store';
88

9-
import { PillSelect } from '../../common/pill';
9+
import { Pill, PillSelect } from '../../common/pill';
1010
import { MediumCard } from '../../common/card';
1111
import { MatchedRuleData, MatchedRulePill, shouldShowRuleDetails } from './matched-rule-pill';
1212

@@ -44,16 +44,20 @@ export const TransformCard = (p: {
4444
onRuleClicked: () => void,
4545
uiStore: UiStore
4646
}) => {
47-
if (!shouldShowRuleDetails(p.matchedRuleData)) return null;
48-
49-
return <MediumCard>
50-
<MatchedRulePill
47+
const rulePill = shouldShowRuleDetails(p.matchedRuleData)
48+
? <MatchedRulePill
5149
ruleData={p.matchedRuleData!}
5250
onClick={p.onRuleClicked}
5351
/>
52+
// This can happen if e.g. upstream returns a response but
53+
// downstream has aborted already:
54+
: <Pill>Inconsistent perspectives</Pill>;
55+
56+
return <MediumCard>
57+
{rulePill}
5458

5559
<PerspectiveSelector
5660
uiStore={p.uiStore}
5761
/>
5862
</MediumCard>;
59-
};
63+
};

0 commit comments

Comments
 (0)