Skip to content
This repository has been archived by the owner on Apr 24, 2019. It is now read-only.

Pass the request body (don't assume this.request.body set) #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kenkunz
Copy link

@kenkunz kenkunz commented Sep 8, 2014

This addresses the same issue as pull request #8, but with a different approach.

A proxy should preserve the original request as much as possible. It's not safe to assume what body parser (if any) an application is using, and it's not ideal to re-stringify a body that's already been parsed to an object. Instead, it seems preferable to get the original, raw request body and pass it through to the destination server.

I took a slightly different approach to testing this as well. The key thing to validate is that the original request is passed-through to the destination server unchanged – so rather than validate a response from the server, I just validate the request body in the destination app's middleware. (This required creating a separate destination app than the one in the setup).

Let me know what you think.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling ba5d442 on kenkunz:master into d650dbc on popomore:master.

@kenkunz
Copy link
Author

kenkunz commented Sep 30, 2014

Any thoughts on merging this?

Thanks,
Ken

@kenkunz
Copy link
Author

kenkunz commented Oct 28, 2014

I see you merged #8. Did you consider this as an alternative? (solves the same problem by passing-through the original raw request body rather than re-srtingifying it)

@popomore
Copy link
Owner

@kenkunz can you rebase master? you can getRawBody in getParsedBody function, I'll review it.

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

Successfully merging this pull request may close these issues.

3 participants