Closed AmolM27 closed 2 years ago
Question unclear.
The fields object can be changed after the .parse callback.
How are you relaying the request ?
So here is code example. I basically want to change the field value to be 'test1.docx' for example. The 'filename' field is set to: 81_105_115_116_54_46_100_111_99_120. I will need to change that from ascii to string before relaying the request. This field is part of the multipart form data. To put some context I mean that field 'name="filename"\r\n' + '\r\n' +
var app = require('express')(); const { createProxyMiddleware } = require('http-proxy-middleware'); var formidable = require('formidable')
const filter = function (pathname, req) {
var form = new formidable.IncomingForm();
form.on('field', function(field, value) {
//receive form fields here
value = 'test1.docx'
return value;
})
return true;
};
app.use('*', createProxyMiddleware(filter, {
target: "
I don't know about createProxyMiddleware, try again on stack overflow maybe
I am currently trying to implement a proxy that modifies field 'filename' and relay that in the proxy request. Formidable is perfect to retreive the value of the field via: form.on('field', function(field, value) { //receive form fields here console.log(field.filename) }) However, can it be updated to take another another value rather than just reading it?