Plugins: Support set body content in plugin routes (#32551)

Adds support for overriding the body and length in plugin routes.
This commit is contained in:
Marcus Efraimsson
2021-03-31 16:38:35 +02:00
committed by GitHub
parent 027e886997
commit aad43869c3
9 changed files with 105 additions and 0 deletions

View File

@@ -131,6 +131,23 @@ To add URL parameters to proxied requests, use the `urlParams` property.
]
```
### Set body content
To set the body content and length of proxied requests, use the `body` property.
```json
"routes": [
{
"path": "example",
"url": "http://api.example.com",
"body": {
"username": "{{ .JsonData.username }}",
"password": "{{ .SecureJsonData.password }}"
}
}
]
```
### Enable token authentication
To enable token-based authentication for proxied requests, use the `tokenAuth` property.

View File

@@ -174,6 +174,7 @@ For data source plugins. Proxy routes used for plugin authentication and adding
| Property | Type | Required | Description |
|----------------|-------------------------|----------|---------------------------------------------------------------------------------------------------------|
| `body` | [object](#body) | No | For data source plugins. Route headers set the body content and length to the proxied request. |
| `headers` | array | No | For data source plugins. Route headers adds HTTP headers to the proxied request. |
| `jwtTokenAuth` | [object](#jwttokenauth) | No | For data source plugins. Token authentication section used with an JWT OAuth API. |
| `method` | string | No | For data source plugins. Route method matches the HTTP verb like GET or POST. |
@@ -183,6 +184,13 @@ For data source plugins. Proxy routes used for plugin authentication and adding
| `tokenAuth` | [object](#tokenauth) | No | For data source plugins. Token authentication section used with an OAuth API. |
| `url` | string | No | For data source plugins. Route URL is where the request is proxied to. |
### body
For data source plugins. Route headers set the body content and length to the proxied request.
| Property | Type | Required | Description |
|----------|------|----------|-------------|
### jwtTokenAuth
For data source plugins. Token authentication section used with an JWT OAuth API.

View File

@@ -350,6 +350,10 @@
"type": "array",
"description": "For data source plugins. Route headers adds HTTP headers to the proxied request."
},
"body": {
"type": "object",
"description": "For data source plugins. Route headers set the body content and length to the proxied request."
},
"tokenAuth": {
"type": "object",
"description": "For data source plugins. Token authentication section used with an OAuth API.",