Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Intercept request before sending #23

Open
muymoo opened this issue Mar 24, 2017 · 0 comments
Open

[Feature Request] Intercept request before sending #23

muymoo opened this issue Mar 24, 2017 · 0 comments

Comments

@muymoo
Copy link

muymoo commented Mar 24, 2017

I am writing zipkin client instrumentation for express-request-proxy . I need a way to intercept the request so I can record it before it is sent and then intercept the response (transformers will probably work for the response).

I've already instrumented plain old request (https://github.com/openzipkin/zipkin-js/tree/master/packages/zipkin-instrumentation-request) so if there was a way to pass in a modified request to express-request-proxy like:

const request = require('request');
const wrapRequest = require('zipkin-instrumentation-request');
const proxy = require('express-request-proxy');

const wrappedRequest = wrapRequest(request, {tracer, serviceName, remoteServiceName});
app.get(proxy({url:'http://api.weather.com'}, wrappedRequest);

it would make my life a lot easier. This could also be used if others want to pass in a request.defaults() instance for express-request-proxy to use.

Another option would be to have decorateRequest like express-http-proxy has which I used here (https://github.com/openzipkin/zipkin-js/blob/master/packages/zipkin-instrumentation-express/src/wrapExpressHttpProxy.js) when instrumenting that client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant