Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

147
Visualizações
POST Binary Buffer to Express Backend that uses Body-Parser as middleware gives an empty Body

I'm sending data from Client to the Backend in 2 forms: both encrypted and non encrypted.

I'm using this Express code:

const express = require('express');
const app = express();

// adding Middlewares ....    

app.use(express.urlencoded({ extended: true, limit: '100mb', parameterLimit: 100000000 }));
app.use(express.json({ limit: '100mb'}));

When I POST a non encrypted body , something as:

method: 'POST',
uri: ** BACKEND-ENDPOINT ** ,
headers: {
    'Content-type': 'application/json',   
    'yourAPIToken': // big token
},  
json: true,
body: 'Some binary data goes here'

The request reaches the Backend and the body is accepted as sent.

However when using Encrypted data , doing something as follows:

const aesjs = require('aes-js');

let encryptedData;

// manipulating data with "aesjs" into "encryptedData"

const dataToSend = Buffer.from(encryptedData, 'binary');

And POSTing this using:

method: 'POST',
uri: ** BACKEND-ENDPOINT ** ,
headers: {
    'Content-type': 'application/json',   
    'yourAPIToken': // big token
},  
json: true,
body: dataToSend

This POST request is accepted in the Backend with empty body , as follows: {}.

Why when I send the data encrypted the Body-Parser of Middleware doesn't work , and how can we fix the Body from being empty ?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda