application/octet-stream webhook body is silently dropped and forwarded as empty {}
Description
When a webhook is sent to a Smee channel with Content-Type: application/octet-stream and a binary body, the payload is lost. The Smee UI displays an empty event, and the smee-client forwards an empty body {} to the local server.
Steps to reproduce
1. Create a Smee channel at https://smee.io
2. Start a local listener:
const EventSource = require('eventsource');
const smeeUrl = 'https://smee.io/YOUR_CHANNEL';
const events = new EventSource(smeeUrl);
events.onmessage = (msg) => {
const data = JSON.parse(msg.data);
console.log('Received body:', data.body);
};
3. Send a binary webhook to the channel:
curl -X POST https://smee.io/YOUR_CHANNEL \
-H "Content-Type: application/octet-stream" \
--data-binary $'\x00\x01\x02\x03\xde\xad\xbe\xef'
Expected behavior
The binary body is forwarded to the local listener, either as a base64-encoded string or as a raw buffer, preserving the original content.
Actual behavior
The Smee UI shows the event with an empty payload:
The local listener receives data.body = {} — the binary body is silently dropped.
Root cause (analysis)
Smee serializes the incoming HTTP request as a JSON SSE event. When the body is binary (application/octet-stream), it cannot be directly embedded in JSON. There is no fallback encoding (e.g. base64), so the body becomes null or {}.
Suggested fix
When Content-Type: application/octet-stream is detected, encode the binary body as base64 in the SSE event and add a flag so clients can decode it:
{
"body": "AAECAw==",
"body_encoding": "base64",
"headers": { "content-type": "application/octet-stream" }
}
Environment
smee-client: 1.2.3
- Node.js: 22
application/octet-streamwebhook body is silently dropped and forwarded as empty{}Description
When a webhook is sent to a Smee channel with
Content-Type: application/octet-streamand a binary body, the payload is lost. The Smee UI displays an empty event, and the smee-client forwards an empty body{}to the local server.Steps to reproduce
1. Create a Smee channel at https://smee.io
2. Start a local listener:
3. Send a binary webhook to the channel:
Expected behavior
The binary body is forwarded to the local listener, either as a base64-encoded string or as a raw buffer, preserving the original content.
Actual behavior
The Smee UI shows the event with an empty payload:
{ "1234567890": {} }The local listener receives
data.body = {}— the binary body is silently dropped.Root cause (analysis)
Smee serializes the incoming HTTP request as a JSON SSE event. When the body is binary (
application/octet-stream), it cannot be directly embedded in JSON. There is no fallback encoding (e.g. base64), so the body becomesnullor{}.Suggested fix
When
Content-Type: application/octet-streamis detected, encode the binary body as base64 in the SSE event and add a flag so clients can decode it:{ "body": "AAECAw==", "body_encoding": "base64", "headers": { "content-type": "application/octet-stream" } }Environment
smee-client: 1.2.3