hubcap waitresponse

Wait for a network response matching a URL pattern.

When to use

Use waitresponse to block until a network response matching a URL pattern is detected. Use waitrequest to wait for the request instead. Use responsebody to get the response content.

Usage

hubcap waitresponse <pattern> [--timeout <duration>]

Arguments

ArgumentTypeRequiredDescription
patternstringYesURL pattern to match against responses

Flags

FlagTypeDefaultDescription
—timeoutduration30sMaximum wait time

Output

FieldTypeDescription
foundboolWhether a matching response was detected
urlstringThe full URL of the matched response
statusintHTTP status code
mimeTypestringMIME type of the response
requestIdstringProtocol request identifier
{"found":true,"url":"https://api.example.com/users","status":200,"mimeType":"application/json","requestId":"1234.5"}

Errors

ConditionExit codeStderr
Missing pattern argument1usage: hubcap waitresponse <pattern> [--timeout <duration>]
Chrome not connected2error: connecting to Chrome: ...
No matching response within timeout3error: timeout

Examples

Wait for a successful API response:

hubcap waitresponse '/api/users'

Wait for a specific resource with a timeout:

hubcap waitresponse '/data.json' --timeout 10s

Click a button and capture the API response (chaining):

hubcap click '#save' && hubcap waitresponse '/api/save' | jq '.status'

See also