How to push a raw transaction using BitcoinJS (and Request)? I'm using BitcoinJS to create a playground for Bitcoin transactions.
I have created the following Javascript file:

const request = require('request');
const proxiedRequest = request.defaults({proxy: "http://localhost:3128"});
const Btc = require('bitcoinjs-lib');
const TestNet = Btc.networks.testnet;
const apiUrl = 'https://testnet.blockexplorer.com/api/addr/';

let privateKey = &lt;my private key&gt;;
let wallet = new Btc.ECPair.fromWIF(privateKey, TestNet);
let publicKey = wallet.getAddress();
console.log("my public key:", publicKey);

let tx = new Btc.TransactionBuilder(TestNet);

let amountWeHave = 100000000; // 1.0 BTC
let amountToKeep = 90000000; // 0.9 BTC
let transactionFee = 1000; // 0.0001 BTC
let amountToSend = amountWeHave - amountToKeep - transactionFee; // ~0.1 (0.0999)

tx.addInput(&lt;one of my input transactions&gt;, 0);

tx.addOutput(&lt;destination public key&gt;, amountToSend);
tx.addOutput(publicKey, amountToKeep);
tx.sign(0, wallet);

let tx_hex = tx.build().toHex();

proxiedRequest.post({
    headers: {'content-type' : 'multipart/mixed'},
    url:     'https://testnet.blockexplorer.com/api/tx/send',
    body:    tx_hex
}, (error, response, body) =&gt; {
    console.log('error', error);
    console.log('body', body);
});


Here is my output:

my public key: &lt;my public key&gt;
error null
body TypeError: Cannot read property &amp;#39;toString&amp;#39; of undefined&lt;br&gt; &amp;nbsp; &amp;nbsp;at Array.types.str (/home/bitcore/lib/bitcore-node/node_modules/bitcoind-rpc/lib/index.js:260:17)&lt;br&gt; &amp;nbsp; &amp;nbsp;at RpcClient.&amp;lt;anonymous&amp;gt; (/home/bitcore/lib/bitcore-node/node_modules/bitcoind-rpc/lib/index.js:236:35)&lt;br&gt; &amp;nbsp; &amp;nbsp;at Bitcoin.sendTransaction (/home/bitcore/lib/bitcore-node/lib/services/bitcoind.js:1791:15)&lt;br&gt; &amp;nbsp; &amp;nbsp;at Node.self.(anonymous function) [as sendTransaction] (/home/bitcore/lib/bitcore-node/lib/node.js:223:27)&lt;br&gt; &amp;nbsp; &amp;nbsp;at TxController.send (/home/bitcore/dev/insight-api/lib/transactions.js:290:13)&lt;br&gt; &amp;nbsp; &amp;nbsp;at Layer.handle [as handle_request] (/home/bitcore/lib/bitcore-node/node_modules/express/lib/router/layer.js:95:5)&lt;br&gt; &amp;nbsp; &amp;nbsp;at next (/home/bitcore/lib/bitcore-node/node_modules/express/lib/router/route.js:131:13)&lt;br&gt; &amp;nbsp; &amp;nbsp;at Route.dispatch (/home/bitcore/lib/bitcore-node/node_modules/express/lib/router/route.js:112:3)&lt;br&gt; &amp;nbsp; &amp;nbsp;at Layer.handle [as handle_request] (/home/bitcore/lib/bitcore-node/node_modules/express/lib/router/layer.js:95:5)&lt;br&gt; &amp;nbsp; &amp;nbsp;at /home/bitcore/lib/bitcore-node/node_modules/express/lib/router/index.js:277:22


Can you tell me what's wrong with my code?
It seems to be a server problem...
Body must be a string.

You can use form instead of body.

Reference: 
https://www.npmjs.com/package/request#forms