# Commands

# Request

Command restbeast r or restbeast request executes given request name.

Given request example-request {} defined in a .hcl file in the current path, running restbeast r example-request will execute the request.

# --timing Displays request times and request chain

HTTP/2.0 200 OK
  │
  ├──PATCH https://httpbin.org/patch
  │  Total Time: 114 ms
  │  Bytes Received: 690 B
  │    │
  │    ├──POST https://httpbin.org/post
  │    │  Total Time: 626 ms
  │    │  Bytes Received: 550 B
  │    │
  │    ├──POST https://httpbin.org/post
  │    │  Total Time: 120 ms
  │    │  Bytes Received: 542 B
  │
  ├──POST https://httpbin.org/post
  │  Total Time: 112 ms
  │  Bytes Received: 540 B

# --detailed-timing Displays detailed request times and request chain

HTTP/2.0 200 OK
  │
  ├──PATCH https://httpbin.org/patch
  │  DNS Resolve Time: 0 ms
  │  Connection Time: 0 ms
  │  First Byte Time: 205 ms
  │  Total Time: 206 ms
  │  Bytes Received: 707 B
  │    │
  │    ├──POST https://httpbin.org/post
  │    │  DNS Resolve Time: 27 ms
  │    │  Connection Time: 212 ms
  │    │  TLS Handshake Time: 622 ms
  │    │  First Byte Time: 827 ms
  │    │  Total Time: 827 ms
  │    │  Bytes Received: 552 B
  │    │
  │    ├──POST https://httpbin.org/post
  │    │  DNS Resolve Time: 0 ms
  │    │  Connection Time: 0 ms
  │    │  First Byte Time: 202 ms
  │    │  Total Time: 202 ms
  │    │  Bytes Received: 558 B
  │
  ├──POST https://httpbin.org/post
  │  DNS Resolve Time: 0 ms
  │  Connection Time: 0 ms
  │  First Byte Time: 204 ms
  │  Total Time: 204 ms
  │  Bytes Received: 540 B

--env Executes command with selected environment definition

env local {}
env live {}

The command below should evaluate given environment.

restbeast request some-request --env live

# -H or --header Displays response headers

Example request result with headers

HTTP/2.0 200 OK

Date: Thu, 11 Feb 2021 10:32:25 GMT
Content-Type: application/json
Content-Length: 548
Server: gunicorn/19.9.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true

# Attack Request

Command restbeast ar or restbeast attack-request continuously executes given request (or request chain) N times in defined period.

Example result with default values;

Status 200 response: %78 (47)
Status 400 response: %15 (9)
Status 500 response: %6 (4)
95 Percentile: 1.091473938s
99 Percentile: 1.100081803s
AverageTime: 585.411933ms

# -c or --count Sets request count

Defaults to 60.

# -p or --period Sets period

Defaults to 60 seconds. Acceptable duration modifiers are s, m, h

Examples:

60s = 60 seconds

10m = 10 minutes

1h = 1 hour

--env Executes command with selected environment definition

env local {}
env live {}

The command below should evaluate given environment.

restbeast ar some-request --env live

# Test

Command restbeast t or restbeast test designed to eval test blocks. Executing a test also executes dependant requests (or request chains). Test command designed to run in continuous integration pipelines. Successful tests results with exit code 0 or any failure will result exit code 1.

test get-example {
  valid-origin = assertIpv4(request.get-example.body.origin)
  valid-host = assertEqual(request.get-example.body.headers.Host, "httpbin.org")
}

The test block example above should result as follows

PASS: valid-host
PASS: valid-origin

2 passes, 0 failures, 2 total.

--env Executes command with selected environment definition

env local {}
env live {}

The command below should evaluate given environment.

restbeast test some-request --env live

# Help

Command restbeast help or restbeast -h or restbeast --help displays help menu.

# Bug

Command restbeast bug will open a browser window and navigate to new issue screen in restbeast github repo.

# Version

Command restbeast version displays restbeast version.

Last Updated: 2/13/2021, 1:46:53 AM