mirror of
https://github.com/aykhans/sarin.git
synced 2026-02-28 14:59:14 +00:00
update docs
This commit is contained in:
@@ -227,26 +227,33 @@ SARIN_BODY='{"product": "car"}'
|
|||||||
|
|
||||||
## Params
|
## Params
|
||||||
|
|
||||||
URL query parameters. If multiple values are provided for a key, Sarin cycles through them in order, starting from a random index for each request. Supports [templating](templating.md).
|
URL query parameters. Supports [templating](templating.md).
|
||||||
|
|
||||||
|
When the same key appears as **separate entries** (in CLI or config file), all values are sent in every request. When multiple values are specified as an **array on a single key** (config file only), Sarin cycles through them.
|
||||||
|
|
||||||
**YAML example:**
|
**YAML example:**
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
params:
|
params:
|
||||||
key1: value1
|
key1: value1
|
||||||
key2: [value2, value3]
|
key2: [value2, value3] # cycles between value2 and value3
|
||||||
|
|
||||||
# OR
|
# OR
|
||||||
|
|
||||||
params:
|
params:
|
||||||
- key1: value1
|
- key1: value1
|
||||||
- key2: [value2, value3]
|
- key2: [value2, value3] # cycles between value2 and value3
|
||||||
|
|
||||||
|
# To send both values in every request, use separate entries:
|
||||||
|
params:
|
||||||
|
- key2: value2
|
||||||
|
- key2: value3 # both sent in every request
|
||||||
```
|
```
|
||||||
|
|
||||||
**CLI example:**
|
**CLI example:**
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
-param "key1=value1" -param "key2=value2" -param "key2=value3"
|
-param "key1=value1" -param "key2=value2" -param "key2=value3" # sends both value2 and value3
|
||||||
```
|
```
|
||||||
|
|
||||||
**ENV example:**
|
**ENV example:**
|
||||||
@@ -257,26 +264,33 @@ SARIN_PARAM="key1=value1"
|
|||||||
|
|
||||||
## Headers
|
## Headers
|
||||||
|
|
||||||
HTTP headers. If multiple values are provided for a key, Sarin cycles through them in order, starting from a random index for each request. Supports [templating](templating.md).
|
HTTP headers. Supports [templating](templating.md).
|
||||||
|
|
||||||
|
When the same key appears as **separate entries** (in CLI or config file), all values are sent in every request. When multiple values are specified as an **array on a single key** (config file only), Sarin cycles through them.
|
||||||
|
|
||||||
**YAML example:**
|
**YAML example:**
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
headers:
|
headers:
|
||||||
key1: value1
|
key1: value1
|
||||||
key2: [value2, value3]
|
key2: [value2, value3] # cycles between value2 and value3
|
||||||
|
|
||||||
# OR
|
# OR
|
||||||
|
|
||||||
headers:
|
headers:
|
||||||
- key1: value1
|
- key1: value1
|
||||||
- key2: [value2, value3]
|
- key2: [value2, value3] # cycles between value2 and value3
|
||||||
|
|
||||||
|
# To send both values in every request, use separate entries:
|
||||||
|
headers:
|
||||||
|
- key2: value2
|
||||||
|
- key2: value3 # both sent in every request
|
||||||
```
|
```
|
||||||
|
|
||||||
**CLI example:**
|
**CLI example:**
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
-header "key1: value1" -header "key2: value2" -header "key2: value3"
|
-header "key1: value1" -header "key2: value2" -header "key2: value3" # sends both value2 and value3
|
||||||
```
|
```
|
||||||
|
|
||||||
**ENV example:**
|
**ENV example:**
|
||||||
@@ -287,26 +301,33 @@ SARIN_HEADER="key1: value1"
|
|||||||
|
|
||||||
## Cookies
|
## Cookies
|
||||||
|
|
||||||
HTTP cookies. If multiple values are provided for a key, Sarin cycles through them in order, starting from a random index for each request. Supports [templating](templating.md).
|
HTTP cookies. Supports [templating](templating.md).
|
||||||
|
|
||||||
|
When the same key appears as **separate entries** (in CLI or config file), all values are sent in every request. When multiple values are specified as an **array on a single key** (config file only), Sarin cycles through them.
|
||||||
|
|
||||||
**YAML example:**
|
**YAML example:**
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
cookies:
|
cookies:
|
||||||
key1: value1
|
key1: value1
|
||||||
key2: [value2, value3]
|
key2: [value2, value3] # cycles between value2 and value3
|
||||||
|
|
||||||
# OR
|
# OR
|
||||||
|
|
||||||
cookies:
|
cookies:
|
||||||
- key1: value1
|
- key1: value1
|
||||||
- key2: [value2, value3]
|
- key2: [value2, value3] # cycles between value2 and value3
|
||||||
|
|
||||||
|
# To send both values in every request, use separate entries:
|
||||||
|
cookies:
|
||||||
|
- key2: value2
|
||||||
|
- key2: value3 # both sent in every request
|
||||||
```
|
```
|
||||||
|
|
||||||
**CLI example:**
|
**CLI example:**
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
-cookie "key1=value1" -cookie "key2=value2" -cookie "key2=value3"
|
-cookie "key1=value1" -cookie "key2=value2" -cookie "key2=value3" # sends both value2 and value3
|
||||||
```
|
```
|
||||||
|
|
||||||
**ENV example:**
|
**ENV example:**
|
||||||
|
|||||||
@@ -134,20 +134,34 @@ headers:
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
**Random headers from multiple values:**
|
**Multiple values for the same header (all sent in every request):**
|
||||||
|
|
||||||
> **Note:** When multiple values are provided for the same header, Sarin starts at a random index and cycles through all values in order. Once the cycle completes, it picks a new random starting point. This ensures all values are used while maintaining some randomness.
|
> **Note:** When the same key appears as separate entries (in CLI or config file), all values are sent in every request.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sarin -U http://example.com -r 1000 -c 10 \
|
sarin -U http://example.com -r 1000 -c 10 \
|
||||||
-H "X-Region: us-east" \
|
-H "X-Region: us-east" \
|
||||||
-H "X-Region: us-west" \
|
-H "X-Region: us-west"
|
||||||
-H "X-Region: eu-central"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>YAML equivalent</summary>
|
<summary>YAML equivalent</summary>
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
url: http://example.com
|
||||||
|
requests: 1000
|
||||||
|
concurrency: 10
|
||||||
|
headers:
|
||||||
|
- X-Region: us-east
|
||||||
|
- X-Region: us-west
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
**Cycling headers from multiple values (config file only):**
|
||||||
|
|
||||||
|
> **Note:** When multiple values are specified as an array on a single key, Sarin starts at a random index and cycles through all values in order. Once the cycle completes, it picks a new random starting point.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
url: http://example.com
|
url: http://example.com
|
||||||
requests: 1000
|
requests: 1000
|
||||||
@@ -159,8 +173,6 @@ headers:
|
|||||||
- eu-central
|
- eu-central
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
**Query parameters:**
|
**Query parameters:**
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
Reference in New Issue
Block a user