@@ -11,7 +11,8 @@ import { uploadFile } from '../../util/ui';
1111import { asError } from '../../util/error' ;
1212
1313import {
14- Handler
14+ Handler ,
15+ RuleType
1516} from '../../model/rules/rules' ;
1617import {
1718 StaticResponseHandler ,
@@ -47,6 +48,7 @@ import { FormatButton } from '../common/format-button';
4748import { byteLength , asBuffer , isProbablyUtf8 } from '../../util' ;
4849
4950type HandlerConfigProps < H extends Handler > = {
51+ ruleType : RuleType ;
5052 handler : H ;
5153 onChange : ( handler : H ) => void ;
5254 onInvalidState : ( ) => void ;
@@ -70,13 +72,15 @@ const ConfigExplanation = styled.p`
7072` ;
7173
7274export function HandlerConfiguration ( props : {
75+ ruleType : RuleType ,
7376 handler : Handler ,
7477 onChange : ( handler : Handler ) => void ,
7578 onInvalidState ?: ( ) => void // Currently unused - intended to improve invalid entry UX later on
7679} ) {
7780 const { handler, onChange, onInvalidState } = props ;
7881
7982 const configProps = {
83+ ruleType : props . ruleType ,
8084 handler : handler as any ,
8185 onChange,
8286 onInvalidState : onInvalidState || _ . noop
@@ -1154,9 +1158,14 @@ class TimeoutHandlerConfig extends HandlerConfig<TimeoutHandler> {
11541158 render ( ) {
11551159 return < ConfigContainer >
11561160 < ConfigExplanation >
1157- When a matching request is received, the server will keep the connection
1158- open but do nothing. With no data or response, most clients will time out
1159- and abort the request after sufficient time has passed.
1161+ When a matching {
1162+ this . props . ruleType === 'http'
1163+ ? 'HTTP'
1164+ // ruleType === 'websocket'
1165+ : 'WebSocket'
1166+ } is received, the server will keep the connection open but do nothing.
1167+ With no data or response, most clients will time out and abort the
1168+ request after sufficient time has passed.
11601169 </ ConfigExplanation >
11611170 </ ConfigContainer > ;
11621171 }
@@ -1167,8 +1176,12 @@ class CloseConnectionHandlerConfig extends HandlerConfig<CloseConnectionHandler>
11671176 render ( ) {
11681177 return < ConfigContainer >
11691178 < ConfigExplanation >
1170- As soon as a matching request is received, the connection will
1171- be closed, with no response.
1179+ As soon as a matching {
1180+ this . props . ruleType === 'http'
1181+ ? 'HTTP'
1182+ // ruleType === 'websocket'
1183+ : 'WebSocket'
1184+ } is received, the connection will be closed, with no response.
11721185 </ ConfigExplanation >
11731186 </ ConfigContainer > ;
11741187 }
0 commit comments