Forward Multipartform Request From One GraphQL API To Other GraphQL API
I'm uploading files from the browser via a multipart request to a GraphQL-API which is powered by graphql-yoga which is powered by express. Now I want to forward this exact same re
Solution 1:
I found a solution here and adapted the function to get the raw body. Now the file contents are not shifted anymore on the target host.
const concatStream = require('concat-stream');
function getRawBody(req, res, next) {
req.getRawBody = new Promise(resolve => {
req.pipe(concatStream(function (data) {
resolve(data);
}));
});
next();
}
Post a Comment for "Forward Multipartform Request From One GraphQL API To Other GraphQL API"