feat: refined implementation for raw binary files handling (#3734) (#3829)

---------
Co-authored-by: marcosadsj <marcosadsj@gmail.com>
Co-authored-by: naman-bruno <naman@usebruno.com>
Co-authored-by: sanish chirayath <sanish@usebruno.com>
This commit is contained in:
Sanjai Kumar
2025-01-28 13:51:50 +05:30
committed by GitHub
parent ecf883ba0d
commit ed56584ba6
25 changed files with 231 additions and 210 deletions

View File

@@ -0,0 +1,15 @@
meta {
name: echo binary
type: http
seq: 1
}
post {
url: {{echo-host}}
body: binaryFile
auth: none
}
body:binary-file {
file: @file(bruno.png) @contentType(image/png)
}

View File

@@ -19,6 +19,17 @@ router.post('/xml-raw', (req, res) => {
return res.send(req.rawBody);
});
router.post('/bin', (req, res) => {
const rawBody = req.body;
if (!rawBody || rawBody.length === 0) {
return res.status(400).send('No data received');
}
res.set('Content-Type', req.headers['content-type'] || 'application/octet-stream');
res.send(rawBody);
});
router.get('/bom-json-test', (req, res) => {
const jsonData = {
message: 'Hello!',

View File

@@ -10,6 +10,7 @@ const multipartRouter = require('./multipart');
const app = new express();
const port = process.env.PORT || 8080;
app.use(express.raw({type: '*/*', limit: '100mb'}));
app.use(cors());
app.use(xmlParser());
app.use(bodyParser.text());