Closed junaidy-johm closed 4 years ago
Hi @junaidy-johm, please excuse my delay on answering you.
Middlewares at route level are also supported, as you can see in the documentation:
// Optional route level middlewares. Default value: []
middlewares: []
You can just attach a custom middleware that extends the request object, it will be considered during the proxying.
Please let me know if this works for you, I could also provide you an example if required.
I am closing this issue because of inactivity.
Add Params or Query from Request How can I add params or query from request api gateway to service through the middleware?
I have tried the code below but the new property seen on the console does not appear
'use strict'
const toArray = require('stream-to-array') const gateway = require('../index')
gateway({ routes: [{ prefix: '/httpbin', target: 'https://httpbin.org', hooks: { async onResponse (req, res, stream) { // collect all streams parts const resBuffer = Buffer.concat(await toArray(stream))
}] }).start(8080)