0
Guys good day I’m with a project in Ode.js and I stuck in a situation,I already researched a lot and I can not find a solution so far. I am creating a Rest api that is consumed through Axios a GLPI (so-called tools) Rest api, I can make most calls but it has a "post" call that my Node.js api receives a form-date and need to pass the file that comes in the request to the other glpi api. I tried the multer however as far as I saw the multer only serves if I want to upload the file to the project server nodejs, but what I need is to send the file to the api glpi through the api Node.js so I am not able to send this file as a parameter in the request , I tried req.file but it doesn’t work.
Note: Before I asked "why then not make the request directly api final glpi", I have a particularity in the design I need to do in this architectural form
    const options2 = {
        headers: {
            'Content-Type': 'multipart/form-data',
            'Session-Token': "xxxxxxxxxxxxxxxxx",
            'App-Token': "xxxxxxxxxxxxxxxxx",
        }
    }
const baseUrl = 'http://localhost/glpi/apirest.php/ticket/';
 followup: async(req) => {
    //console.log(req.file);
    await axios.post(`${baseUrl}${req.body.id}/TicketFollowup/`, {
            "input": {
                "tickets_id": `${req.body.id}`,
                "content": "test 123 follow",
            }
        }, options2,req.file)
        .then(response => res.send(response.data))
        .catch(error => console.log(error));
}
the code snippet above is already in the layer "service" being called in the layer "Routes" already tried from the console.log(req.file) it brings the data of the file I sent by Postman, however when I try to send this error:
date: [ 'ERROR_UPLOAD_FILE_TOO_BIG_POST_MAX_SIZE', 'The file seems Too big' ] }, isAxiosError: true, toJSON: [Function] }
being that if send by glpi api the same file I can send without problems .
Try to set the Boundary in Content-Type to the limits of the parameter
– Rafael Costa