I am trying to establish a persistent connection between our node (express.js
) server and a vendor server. We are currently using the "request"
library, though we can easily move to something else. https://www.npmjs.com/package/request
The vendor has told us that the body of the Post request (to their API) needs to come before things like Content-Type, charset,
etc. So like this:
"POST / HTTP/1.1\r\nREQUEST_JSON_API: **{\"REQUEST_TYPE\":\"STATUS\"}** \r\nContent-Type: application/json\r\ncharset: utf-8\r\nUser-Agent.."
Instead of how it's currently coming across:
"POST / HTTP/1.1\r\nhost: xxx.x.xxx.1:3000\r\naccept: application/json\r\ncontent-type: application/json\r\ncontent-length: 25\r\nConnection: keep-alive\r\n\r\n **{\"REQUEST_TYPE\":\"STATUS\"}**"
Does anyone have any advice on how to tackle this please?