Data sent from Node via Mac. This fails:
POST / HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: multipart/form-data; boundary=--------------------------410170969577572462482590
Authorization: Basic U3dlY2q9DdlRvQ29uqdGFjdDpVM2RsWTI5RGRsUnZqRMjl1ZEdGamRB
User-Agent: axios/0.18.0
Content-Length: 437
Host: localhost:3000
Connection: close
{
"_overheadLength": 105,
"_valueLength": 5,
"_valuesToMeasure": {},
"writable": false,
"readable": true,
"dataSize": 0,
"maxDataSize": 2097152,
"pauseStreams": true,
"_released": false,
"_streams": {
"0": "----------------------------097921969493700670690484\r\nContent-Disposition: form-data; name=\"Domain\"\r\n\r\n",
"1": "Test"
},
"_currentStream": {},
"_insideLoop": false,
"_pendingNext": false,
"_boundary": "--------------------------097921969493700670690484"
}
Data sent from Postman from Windows. This works:
POST / HTTP/1.1
Content-Type: multipart/form-data; boundary=--------------------------214255515908701131866697
Authorization: Basic U3dlY29DwerdlRvQ29uwerdGFjdDpVM2RsWTwerI5RGRsUnZRMjl1ZEdGamRB
User-Agent: PostmanRuntime/7.15.0
Accept: */*
Cache-Control: no-cache
Postman-Token: 4af4ff14-1abd-4ab7-9e01-5ddd846acfa9
Host: localhost:3020
accept-encoding: gzip, deflate
content-length: 383
Connection: keep-alive
----------------------------214255515908701131866697
Content-Disposition: form-data; name="Domain"
test
--
It seem's node add row brakes: \r\n\r\n
here and there.
This causes a failure from a windows server when I post data to it: "Line length 100 exceeded".
See this question: Sending post request multipart form data. Error from some microsoft service "Line length limit 100 exceeded"
I'm using this the form-data package to post data combined with axios.
Is it possible to add some filter/middleware etc that removes alla /n/r etc in my post request?
Update
My request from node:
const form_data = new FormData();
form_data.append('Domain', 'test');
const request_config = {
headers: {
"Authorization": "Basic dffdg",
"Content-Type": `multipart/form-data; boundary=${form_data._boundary}`
},
data: form_data
};
await axios.post(url, form_data, request_config).then(response => {
try removing
data
fromrequest_config
.from axios/axios documentation