Skip to content

Commit

Permalink
another formatting error
Browse files Browse the repository at this point in the history
  • Loading branch information
Elisa Sawyer authored and Elisa Sawyer committed Jan 29, 2024
1 parent 3630383 commit be3a9fb
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion _site/docs/webhooks-and-callbacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ of events or perform long-running processing asynchronously without blocking.

## Enabling webhooks

Prior to WireMock 3.1.0, webhooks were provided using an extension and needed to be explicitly enabled. See [the 2.x docs](https://wiremock.org/2.x/docs/webhooks-and-callbacks/) for details on how to do this.
Prior to WireMock 3.1.0 webhooks were provided via an extension and needed to be explicitly enabled. See [the 2.x docs](https://wiremock.org/2.x/docs/webhooks-and-callbacks/) for details on how to do this.

From version 3.1.0 the webhooks extension is part of WireMock's core and enabled by default.

Expand Down Expand Up @@ -88,6 +88,8 @@ We could construct a JSON request body in the webhook like this:

=== "Java"

{% raw %}

```java
wm.stubFor(post(urlPathEqualTo("/templating"))
.willReturn(ok())
Expand All @@ -99,8 +101,12 @@ We could construct a JSON request body in the webhook like this:
);
```

{% endraw %}

=== "JSON"

{% raw %}

```json
{
"request": {
Expand All @@ -126,6 +132,8 @@ We could construct a JSON request body in the webhook like this:
}
```

{% endraw %}

!!! note

Webhook templates currently do not support system or environment variables.
Expand All @@ -137,6 +145,7 @@ we can use templating on the URL and method.

=== "Java"

{% raw %}
```java
wm.stubFor(post(urlPathEqualTo("/something-async"))
.willReturn(ok())
Expand All @@ -145,9 +154,11 @@ we can use templating on the URL and method.
.withUrl("{{jsonPath originalRequest.body '$.callbackUrl'}}"))
);
```
{% endraw %}

=== "JSON"

{% raw %}
```json
{
"request": {
Expand All @@ -169,6 +180,8 @@ we can use templating on the URL and method.
}
```

{% endraw %}

## Adding delays

A fixed or random delay can be added before the webhook call is made, using the same style of [delay parameters as stubs](./simulating-faults.md).
Expand All @@ -177,6 +190,8 @@ A fixed or random delay can be added before the webhook call is made, using the

=== "Java"

{% raw %}

```java
wm.stubFor(post(urlPathEqualTo("/delayed"))
.willReturn(ok())
Expand All @@ -187,9 +202,12 @@ A fixed or random delay can be added before the webhook call is made, using the
)
);
```
{% endraw %}

=== "JSON"

{% raw %}

```json
{
"request": {
Expand All @@ -214,11 +232,14 @@ A fixed or random delay can be added before the webhook call is made, using the
]
}
```
{% endraw %}

### Random delays

=== "Java"

{% raw %}

```java
wm.stubFor(post(urlPathEqualTo("/delayed"))
.willReturn(ok())
Expand All @@ -229,9 +250,11 @@ A fixed or random delay can be added before the webhook call is made, using the
)
);
```
{% endraw %}

=== "JSON"

{% raw %}
```json
{
"request": {
Expand All @@ -257,6 +280,7 @@ A fixed or random delay can be added before the webhook call is made, using the
]
}
```
{% endraw %}

## Extending webhooks

Expand Down

0 comments on commit be3a9fb

Please sign in to comment.