K
K
kator2019-09-07 11:47:49
Node.js
kator, 2019-09-07 11:47:49

Send buffer POST request?

You need to send a POST request with a buffer. The problem is that Node.js requires either a string or a buffer .

// Делаю стандартными средствами Node.js, так как нагляднее

const http = require('http');

const postData = {
  'encodedText': buffer
};

const req = http.request();

req.write(postData);
req.end();

I end up with an error
TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be one of type string or Buffer. Received type object

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question