kinesalite
kinesalite copied to clipboard
Fix invalid record data returned after CBOR-encoded put request
Problem
- Put record with CBOR-encoded request (e.g. using AWS Java SDK)
- Get records -> malformed JSON response
{
"Records": [
...
{
"SequenceNumber": "49616645143474350269062001186086684333515393213082370050",
"ApproximateArrivalTimestamp": 1616506576.795,
"Data": {
"type": "Buffer",
"data": [
104,
101,
108,
108,
111
]
},
"PartitionKey": "hello"
},
...
],
...
}
Data should be base64-encoded string but Buffer object is stringified as-is.
Proposed fix
If Buffer is given as Blob typed parameter, convert it into base64-encoded string.
An alternative approach could be: encode Buffers when writing responses.
Related: #108
👍 works for me as well. Any chance this will get merged?