-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add changelog and update docs for v8.4.0
- Loading branch information
Showing
60 changed files
with
233 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
title: JWT helpers | ||
meta: | ||
title: Create dynamic responses with templating helpers | ||
description: "Create dynamic fake data for your mock server with Mockoon's templating helpers. All formats are supported: JSON, CSV, HTML, etc." | ||
order: 503 | ||
--- | ||
|
||
# JWT helpers | ||
|
||
--- | ||
|
||
Mockoon [templating system](docs:templating/overview) includes various helpers to help you create dynamic responses. This page lists the helpers related to JWT tokens. | ||
|
||
## jwtPayload | ||
|
||
Extract a property from a JWT token's payload. The full token must be passed as the first argument. It will automatically ignore the `Bearer ` prefix if present, to make it easier to use it with the `Authorization` header. | ||
If no property is passed, the full payload object will be returned to be used with other helpers like `lookup`. | ||
|
||
| Arguments (ordered) | Type | Description | | ||
| ------------------- | ------ | ----------- | | ||
| 0 | string | JWT token | | ||
| 1 | string | Property | | ||
|
||
**Examples** | ||
|
||
```handlebars | ||
<!-- Returns the full payload object --> | ||
{{jwtPayload 'abcd...'}} | ||
<!-- Returns the 'sub' property using lookup --> | ||
{{lookup (jwtPayload 'abcd...') 'sub'}} | ||
<!-- Returns the 'sub' property --> | ||
{{jwtPayload 'abcd...' 'sub'}} | ||
<!-- Use with header helper (no need to remove 'Bearer ' from the header content) --> | ||
{{jwtPayload (header 'Authorization') 'sub'}} | ||
``` | ||
|
||
## jwtHeader | ||
|
||
Extract a property from a JWT token's header. The full token must be passed as the first argument. It will automatically ignore the `Bearer ` prefix if present, to make it easier to use it with the `Authorization` header. | ||
If no property is passed, the full header object will be returned to be used with other helpers like `lookup`. | ||
|
||
| Arguments (ordered) | Type | Description | | ||
| ------------------- | ------ | ----------- | | ||
| 0 | string | JWT token | | ||
| 1 | string | Property | | ||
|
||
**Examples** | ||
|
||
```handlebars | ||
<!-- Returns the full payload object --> | ||
{{jwtHeader 'abcd...'}} | ||
<!-- Returns the 'alg' property using lookup --> | ||
{{lookup (jwtHeader 'abcd...') 'alg'}} | ||
<!-- Returns the 'alg' property --> | ||
{{jwtHeader 'abcd...' 'alg'}} | ||
<!-- Use with header helper (no need to remove 'Bearer ' from the header content) --> | ||
{{jwtHeader (header 'Authorization') 'alg'}} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
--- | ||
meta: | ||
title: Mockoon release v8.4.0 | ||
description: Discover Mockoon applications new v8.4.0 release with templating support in rules property/path, new JWT templating helpers, dot notation support in the CRUD route key, random latencies, and many more improvements and fixes. | ||
date: '2024-08-05' | ||
--- | ||
|
||
Welcome to this new release of Mockoon. It brings new exciting features: **templating support in rules property/path**, **new JWT templating helpers**, **dot notation support in the CRUD route key**, **random latencies**, and many more improvements and fixes. | ||
Read on to learn more about this release. | ||
|
||
--- | ||
|
||
## Our sponsors | ||
|
||
[![GitHub](https://mockoon.com/images/sponsors/github.png)](https://github.blog/2023-04-12-github-accelerator-our-first-cohort-and-whats-next/) | ||
[![Localazy](https://mockoon.com/images/sponsors/localazy.png)](https://localazy.com/register?ref=a9CiDC61gOac-azO) | ||
|
||
Mockoon is an open-source project built by volunteer maintainers. If you like our application, please consider sponsoring us and join all the [Sponsors and Backers](https://github.com/mockoon/mockoon/blob/main/backers.md) who helped this project over time! | ||
|
||
[![sponsor button](https://mockoon.com/images/sponsor-btn-250.png?)](https://github.com/sponsors/mockoon) | ||
|
||
--- | ||
|
||
## Templating support in rules property/path | ||
|
||
**Templating helpers** are now available in the **response rules property or path field**. You can dynamically target a specific body property, header name, etc. using templating helpers: | ||
|
||
![rules target with template helper{1071x176}](/images/releases/8.4.0/templating-support-in-rules-target.png) | ||
|
||
[Response rules documentation](https://mockoon.com/docs/latest/route-responses/dynamic-rules/#2-property-name-or-path) | ||
|
||
(Issue [#1443](https://github.com/mockoon/mockoon/issues/1443)) | ||
|
||
## New JWT templating helpers | ||
|
||
Two new templating helpers are now available to help you **decode JWT tokens** in your responses: `jwtPayload` and `jwtHeader`. They let you access the **payload** and **header** objects respectively. These helpers are compatible with other templating helpers like `header`. They will also automatically ignore the `Bearer ` prefix if present in the provided string, to make it easier to use them with an `Authorization` header. | ||
|
||
```handlebars | ||
{{jwtPayload 'abcd...' 'sub'}} | ||
{{jwtHeader 'abcd...' 'alg'}} | ||
{{jwtPayload (header 'Authorization') 'sub'}} | ||
{{jwtHeader (header 'Authorization') 'alg'}} | ||
``` | ||
|
||
Check the [helpers documentation](https://mockoon.com/docs/latest/templating/jwt-helpers/) for more information. | ||
|
||
(Issue [#774](https://github.com/mockoon/mockoon/issues/774)) | ||
|
||
## Dot notation support in the CRUD route's key | ||
|
||
CRUD route key now supports **dot notation**. It allows you to perform CRUD operations (e.g. get by id, update by id, etc.) based on nested properties: | ||
|
||
```json | ||
{ | ||
"data": { | ||
"id": 1 | ||
} | ||
} | ||
``` | ||
|
||
![CRUD route key with property containing a dot{1072x211}](/images/releases/8.4.0/dot-notation-in-crud-route-key.png) | ||
|
||
[CRUD routes documentation](https://mockoon.com/docs/latest/api-endpoints/crud-routes/) | ||
|
||
(Issue [#1433](https://github.com/mockoon/mockoon/issues/1433)) | ||
|
||
## Random latencies | ||
|
||
You can now **randomize the latency** of your route responses and environments. This feature is useful to simulate network latency variations and test your application's behavior under different network conditions. | ||
It will randomize the latency of the response **between 0 and the value you set** in the environment or route parameters. | ||
|
||
The option can be found in the application settings: | ||
|
||
![Random latency settings{801x908}](/images/releases/8.4.0/random-latency-settings.png) | ||
|
||
Options are also available in the [CLI](https://github.com/mockoon/mockoon/tree/main/packages/cli), in the form of a flag `--enable-random-latency`, and in the [serverless package](https://github.com/mockoon/mockoon/tree/main/packages/serverless), in the form of a new `enableRandomLatency` option: | ||
|
||
```javascript | ||
const mockoonServerless = new mockoon.MockoonServerless(mockEnv, { | ||
enableRandomLatency: true | ||
}); | ||
``` | ||
|
||
(Issue [#568](https://github.com/mockoon/mockoon/issues/568)) | ||
|
||
## Logs timestamp improvement | ||
|
||
In the logs tab, the logs timestamps are now displayed in a human-readable format like `7 hours ago` instead of `2024-01-01 08:00:00.123`. | ||
|
||
![Human-readable logs timestamps{624x175}](/images/releases/8.4.0/human-readable-logs-timestamps.png) | ||
|
||
(Issue [#1430](https://github.com/mockoon/mockoon/issues/1430)) | ||
|
||
## Mockoon Cloud desktop application improvements | ||
|
||
- Custom scheme based authentication in the desktop application was replaced by a callback-based flow. (Issue [#1463](https://github.com/mockoon/mockoon/issues/1463)) | ||
- Fixed account downgrading not updating the running instances list. (Issue [#1461](https://github.com/mockoon/mockoon/issues/1461)) | ||
- Automatically refresh the instances list when opening the instances management dialog: (Issue [#1478](https://github.com/mockoon/mockoon/issues/1478)) | ||
|
||
## Fixes | ||
|
||
- Last opened environment is now correctly saved after opening. (Issue [#1404](https://github.com/mockoon/mockoon/issues/1404)) | ||
- Fixed a null pointer when the last saved environment was deleted. (Issue [#1459](https://github.com/mockoon/mockoon/issues/1459)) | ||
|
||
## Chores | ||
|
||
We updated the libraries and applications dependencies to their latest versions to fix some reported vulnerabilities. | ||
|
||
### Thank you | ||
|
||
A big thank you to the following people who helped to make Mockoon better: | ||
|
||
- [@impeas](https://github.com/impeas): Random latency support. (Issue [#568](https://github.com/mockoon/mockoon/issues/568)) | ||
- [@TCezarRod](https://github.com/TCezarRod): Oclif dependencies update. (Issue [#1469](https://github.com/mockoon/mockoon/issues/1469)) |
Oops, something went wrong.