Skip to content

Commit 67d0de7

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 b7e47d5 commit 67d0de7

File tree

4 files changed

+36
-31
lines changed

4 files changed

+36
-31
lines changed

package-lock.json

+24-23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
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.27.0",
112112
"node-forge": "^1.3.0",
113113
"openapi-directory": "^1.3.0",

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

+9-5
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

+2-2
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)