Skip to content

Commit

Permalink
SMTP: ReceivedContent refactoring part 4 - Rewriting HTTP endpoints t…
Browse files Browse the repository at this point in the history
…o enable traversing nested Multipart
  • Loading branch information
Lucas Hinderberger committed Jul 2, 2024
1 parent cfa9f61 commit 4b1f3d1
Show file tree
Hide file tree
Showing 4 changed files with 285 additions and 179 deletions.
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2675,7 +2675,7 @@ the corresponding index is made available as JSON:
```json
{
"body_size": 306,
"bodySize": 306,
"from": [
"testsender2@programmfabrik.de"
],
Expand Down Expand Up @@ -2732,46 +2732,50 @@ following schema:
"count": 2,
"multiparts": [
{
"body_size": 15,
"bodySize": 15,
"headers": {
"Content-Type": [
"text/plain; charset=utf-8"
]
},
"idx": 0
"isMultipart": false
},
{
"body_size": 39,
"bodySize": 39,
"headers": {
"Content-Type": [
"text/html; charset=utf-8"
]
},
"idx": 1
"isMultipart": false
}
]
}
```

#### /smtp/$idx/multipart/$partIdx
#### /smtp/$idx[/multipart/$partIdx]+
On the `/smtp/$idx/multipart/$partIdx` endpoint (e.g. `/smtp/1/multipart/0`),
metadata about the multipart with the corresponding index is made available:

```json
{
"body_size": 15,
"bodySize": 15,
"headers": {
"Content-Type": [
"text/plain; charset=utf-8"
]
},
"idx": 0
"idx": 0,
"isMultipart": false
}
```

Headers that were encoded according to RFC2047 are decoded first.

#### /smtp/$idx/multipart/$partIdx/body
The endpoint can be called recursively for nested multipart messages, e.g.
`/smtp/1/multipart/0/multipart/1`.

#### /smtp/$idx[/multipart/$partIdx]+/body
On the `/smtp/$idx/multipart/$partIdx/body` endpoint (e.g.
`/smtp/1/multipart/0/body`), the body of the multipart (excluding headers)
is made available.
Expand All @@ -2781,3 +2785,6 @@ or `quoted-printable`, the endpoint returns the decoded body.

If the message was sent with a `Content-Type` header, it will be passed through
to the HTTP response.

The endpoint can be called recursively for nested multipart messages, e.g.
`/smtp/1/multipart/0/multipart/1/body`.
Loading

0 comments on commit 4b1f3d1

Please sign in to comment.