I am not sure what the issue is, but it seems to be on the side of your backed? I modified your script slightly to point it to httpbin.org:
import http from 'k6/http';
export default function (data) {
const requestBody = JSON.stringify({
"facts": [
{
"==": ["source_hash", "3ad3031f5503a5504af825262ee8232cc04d4ea6683d42c5ee0a2f2a27ac9824"]
},
{
"==": ["mime", "text/plain"]
},
{
"==": ["size", 5]
},
{
"==": ["receiver", 1000]
},
{
"==": ["creation_time", 1598322122]
}
]
});
const headers = {
headers: {
'Authorization': `Bearer some-token`,
'Content-Type': 'application/cnd.proof-v2+json',
},
};
let res = http.post(`https://httpbin.org/anything/123/proofs`, requestBody, headers);
console.log(res.body);
}
and the result I get is
{
"args": {},
"data": "{\"facts\":[{\"==\":[\"source_hash\",\"3ad3031f5503a5504af825262ee8232cc04d4ea6683d42c5ee0a2f2a27ac9824\"]},{\"==\":[\"mime\",\"text/plain\"]},{\"==\":[\"size\",5]},{\"==\":[\"receiver\",1000]},{\"==\":[\"creation_time\",1598322122]}]}",
"files": {},
"form": {},
"headers": {
"Authorization": "Bearer some-token",
"Content-Length": "209",
"Content-Type": "application/cnd.proof-v2+json",
"Host": "httpbin.org",
"User-Agent": "k6/0.30.0 (https://k6.io/)",
"X-Amzn-Trace-Id": "Root=1-600eb362-16fbfabf2990ed892d3c47fd"
},
"json": {
"facts": [
{
"==": [
"source_hash",
"3ad3031f5503a5504af825262ee8232cc04d4ea6683d42c5ee0a2f2a27ac9824"
]
},
{
"==": [
"mime",
"text/plain"
]
},
{
"==": [
"size",
5
]
},
{
"==": [
"receiver",
1000
]
},
{
"==": [
"creation_time",
1598322122
]
}
]
},
"method": "POST",
"origin": "88.203.157.59",
"url": "https://httpbin.org/anything/123/proofs"
}
See "Content-Type": "application/cnd.proof-v2+json"
, the server received the correct value from k6