Comments (6)
@f1erro and I talked about this yesterday.
- Passing
null
as the second parameter of thenext
function inondata_response
streams the originaldata
chunk. - The
data
parameter is actually an object ofpluginOptions
. To access the chunk, you have to usedata.data
. - The second parameter of
next
used in theonend_response
function appends to the end of the stream, because the data elements have already been pushed to the stream inondata_response
.
from microgateway-core.
To get your example to work, you need to pass an empty buffer like so:
'use strict';
var debug = require('debug')('plugin:response-override');
var emptyBuffer = new Buffer(0);
module.exports.init = function(config, logger, stats) {
return {
ondata_response: function(req, res, data, next) {
debug('***** plugin ondata_response');
next(null, emptyBuffer);
},
onend_response: function(req, res, data, next) {
debug('***** plugin onend_response');
next(null, "Hello, World!\n\n");
}
};
}
from microgateway-core.
@WWitman FYI: Docs are totally borked for plugins, but that's okay for now, because the actual plugin functionality appears to have never worked properly in v2. We're going to look at what we need to do to fix or redesign the broken implementation and will get back to you.
from microgateway-core.
Yeah. There are definitely a few issues going on here. At least one issue I
have a fix for. I've got a way to pass null instead of an empty buffer to
override a response body.
-Matt
--
Matthew Dobson | apigee https://apigee.com/ | m: +1.734.634.5472 |
twitter @mdobs http://twitter.com/mdobs @apigee
https://twitter.com/apigee | Apigee Community
http://community.apigee.com/ for answers, ideas and support!
http://adapt.apigee.com
On Tue, Oct 11, 2016 at 2:41 PM, Kevin Swiber [email protected]
wrote:
@WWitman https://github.com/WWitman FYI: Docs are totally borked for
plugins, but that's okay for now, because the actual plugin functionality
appears to have never worked properly in v2. We're going to look at what we
need to do to fix or redesign the broken implementation and will get back
to you.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#17 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA5BsA9Ayu9Io2_Baugv9cI9lEgEunJDks5qy9hAgaJpZM4KTmc3
.
from microgateway-core.
We're about to implement a plugin. What do we need to know about how to do this if the "documentation is borked".
from microgateway-core.
See @kevinswiber s work around if you need to do body transformation currently. In a release coming out this week we'll have fixes in EM to actually make the documentation correct again.
from microgateway-core.
Related Issues (20)
- Timestamp on console logs HOT 2
- xss vulnerability HOT 4
- edgemicro tracing issue
- Overriding a header from the target response is needlessly hard
- microgateway-config dependency
- Headers section should include X-Forwarded-Proto HOT 4
- [Feature request] Configurable connection timeout between EdgeMicro and Target Server
- Better message when a proxy isn't found for a host / path pairing
- Cannot use self-signed certificates to connect to backend server HOT 6
- Early access dies when apid is down HOT 2
- Early Access won't start if no configurations are staged HOT 1
- if we have 2 bundle configs with same name and one of them deployed, when you try to deploy the other one -> mg fails
- EM should run when no deployments present
- Unstaging Early Access bundle crashes gateway HOT 7
- Its not possible to change the full target endpoint inside a plugin HOT 2
- Issue with wildcard support in 2.4.5-beta
- Protocol not supported error on plugin redirecting to HTTPS target HOT 8
- Proxy tunneling support
- Execute plugins for the request with invalid path HOT 1
- EMG logging produces blank lines on STDOUT HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from microgateway-core.