Merge pull request #373 from moorereason/feature/multipart

Add multipart form data support
This commit is contained in:
Adnan Hajdarević 2019-12-26 12:46:31 +01:00 committed by GitHub
commit f38dfbbf78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 251 additions and 44 deletions

View file

@ -287,12 +287,12 @@ __Not recommended in production due to low security__
]
```
# JIRA Webhooks
## JIRA Webhooks
[Guide by @perfecto25](https://sites.google.com/site/mrxpalmeiras/notes/jira-webhooks)
# Pass File-to-command sample
## Pass File-to-command sample
## Webhook configuration
### Webhook configuration
<pre>
[
@ -315,7 +315,7 @@ __Not recommended in production due to low security__
]
</pre>
## Sample client usage
### Sample client usage
Store the following file as `testRequest.json`.
@ -474,3 +474,47 @@ Given the following payload:
}
]
```
## Multipart Form Data
Example of a [Plex Media Server webhook](https://support.plex.tv/articles/115002267687-webhooks/).
The Plex Media Server will send two parts: payload and thumb.
We only care about the payload part.
```json
[
{
"id": "plex",
"execute-command": "play-command.sh",
"parse-parameters-as-json": [
{
"source": "payload",
"name": "payload"
}
],
"trigger-rule":
{
"match":
{
"type": "value",
"parameter": {
"source": "payload",
"name": "payload.event"
},
"value": "media.play"
}
}
}
]
```
Each part of a multipart form data body will have a `Content-Disposition` header.
Some example headers:
```
Content-Disposition: form-data; name="payload"
Content-Disposition: form-data; name="thumb"; filename="thumb.jpg"
```
We key off of the `name` attribute in the `Content-Disposition` value.