Skip to content

Commit b79e63c

Browse files
committed
Update Mockttp for assorted rule event & websocket fixes
This notably makes TLS source data optional. Previously we tried to ensure TLS data always had source addresses, but seemingly due to internal Node oddities that wasn't actually possible. We now allow this edge case, so the UI needs to handle that explicitly.
1 parent 687d9ab commit b79e63c

File tree

4 files changed

+36
-31
lines changed

4 files changed

+36
-31
lines changed

package-lock.json

Lines changed: 24 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
"mobx-shallow-undo": "^1.0.0",
108108
"mobx-utils": "^5.1.0",
109109
"mockrtc": "^0.3.1",
110-
"mockttp": "^3.15.4",
110+
"mockttp": "^3.17.1",
111111
"monaco-editor": "^0.51.0",
112112
"node-forge": "^1.3.0",
113113
"openapi-directory": "^1.3.0",

src/components/view/tls/tls-failure-details-pane.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ export class TlsFailureDetailsPane extends React.Component<{
2727
render() {
2828
const { failure, certPath } = this.props;
2929

30-
const sourceDetailParts = getReadableIP(failure.remoteIpAddress).split(' ');
31-
const sourceIp = sourceDetailParts[0];
32-
const sourceDetails = sourceDetailParts.slice(1).join(' ');
30+
// This _should_ always be available, but due to some awkward & unclear Node issues it isn't,
31+
// so we need to be a little careful here.
32+
const sourceDetailParts = failure.remoteIpAddress
33+
? getReadableIP(failure.remoteIpAddress).split(' ')
34+
: undefined;
35+
const sourceIp = sourceDetailParts?.[0];
36+
const sourceDetails = sourceDetailParts?.slice(1).join(' ');
3337

3438
return <PaneScrollContainer>
3539
<MediumCard>
@@ -61,11 +65,11 @@ export class TlsFailureDetailsPane extends React.Component<{
6165
</>,
6266
} as _.Dictionary<JSX.Element>)[failure.failureCause]
6367
}</p>
64-
<p>
68+
{ sourceIp && sourceDetails && <p>
6569
The request was sent by <CopyableMonoValue>
6670
{ sourceIp }
6771
</CopyableMonoValue> { sourceDetails }.
68-
</p>
72+
</p> }
6973
</Content>
7074

7175
<ContentLabelBlock>Cause</ContentLabelBlock>

src/model/http/har.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ export type HarTlsErrorEntry = {
9595

9696
tlsMetadata?: TlsSocketMetadata;
9797

98-
clientIPAddress: string;
99-
clientPort: number;
98+
clientIPAddress?: string;
99+
clientPort?: number;
100100
}
101101

102102
export async function generateHar(

0 commit comments

Comments
 (0)