WebSocketRuleBuilder | mockttp
Hierarchy
- BaseRuleBuilder
- WebSocketRuleBuilder
Index
Matching
forHost
forHostname
forPort
matching
- matching(content): this
Parameters
- content: ((request: CompletedRequest) => MaybePromise<boolean>)
- (request): MaybePromise<boolean>
Returns MaybePromise<boolean>
Returns this
- content: ((request: CompletedRequest) => MaybePromise<boolean>)
withBody
withBodyIncluding
withCookie
withExactQuery
withForm
withHeaders
withJsonBody
withJsonBodyIncluding
withMultipartForm
withProtocol
withQuery
withUrlMatching
Other
constructor
- new
Web (path, addRule): WebSocketRuleBuilderSocket Rule Builder Parameters
- path: undefined | string | RegExp
- addRule: ((rule: WebSocketRuleData) => Promise<MockedEndpoint>)
- (rule): Promise<MockedEndpoint>
Returns Promise<MockedEndpoint>
Returns WebSocketRuleBuilder
asPriority
delay
Responses
thenCloseConnection
- then
Close (): Promise<MockedEndpoint>Connection Returns Promise<MockedEndpoint>
thenEcho
- then
Echo (): Promise<MockedEndpoint> Returns Promise<MockedEndpoint>
thenForwardTo
- then
Forward (target, options?): Promise<MockedEndpoint>To Returns Promise<MockedEndpoint>
thenPassivelyListen
- then
Passively (): Promise<MockedEndpoint>Listen Returns Promise<MockedEndpoint>
thenPassThrough
- then
Pass (options?): Promise<MockedEndpoint>Through Returns Promise<MockedEndpoint>
thenRejectConnection
- then
Reject (statusCode, statusMessage?, headers?, body?): Promise<MockedEndpoint>Connection Parameters
- statusCode: number
OptionalstatusMessage: stringOptionalheaders: HeadersOptionalbody: string | Buffer
Returns Promise<MockedEndpoint>
thenResetConnection
- then
Reset (): Promise<MockedEndpoint>Connection Returns Promise<MockedEndpoint>
thenTimeout
- then
Timeout (): Promise<MockedEndpoint> Returns Promise<MockedEndpoint>