Open iocmet opened 10 months ago
After recursive code commenting and running script i found that this line causes error (still looking for most low level reason)
For some strange reason "equals" method is being added to headers, self.headers:
{
... other headers
equals: [Function: objectEquals]
}
Root of problem is in caseless package and it happened because i declared equals method in Object prototype, you can access objects from prototype with for loop or like obj['protoValue']
Summary
When i tried send discord message with bot token that contains file i ran into this exception
throw new Error(error);
^
Error: TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["equals"]
at Request._callback (/data/data/com.termux/files/home/Parser-Bot/node_modules/async-request/src/main.js:24:27)
at self.callback (/data/data/com.termux/files/home/Parser-Bot/node_modules/request/request.js:185:22)
at Request.emit (node:events:523:35)
at Request.start (/data/data/com.termux/files/home/Parser-Bot/node_modules/request/request.js:753:10)
at Request.write (/data/data/com.termux/files/home/Parser-Bot/node_modules/request/request.js:1491:10)
at FormData.ondata (node:internal/streams/legacy:20:31)
at FormData.emit (node:events:511:28)
at CombinedStream.write (/data/data/com.termux/files/home/Parser-Bot/node_modules/combined-stream/lib/combined_stream.js:138:8)
at CombinedStream._pipeNext (/data/data/com.termux/files/home/Parser-Bot/node_modules/combined-stream/lib/combined_stream.js:126:8)
at CombinedStream._realGetNext (/data/data/com.termux/files/home/Parser-Bot/node_modules/combined-stream/lib/combined_stream.js:99:10)
Simplest Example to Reproduce
Im not sure why it happening but you can try send discord message with file
Expected Behavior
POST request will just be send
Current Behavior
Invalid character in header content error
Possible Solution
I don't know
Context
Send discord message from bot account with file (maybe send POST with multipart/form-data type is more correct but i successfully do this using request before)
Your Environment
Android armv8 (not matters at all i think)