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

how to access request and response data from the proxy server #118

Open
tasin-megamind opened this issue Aug 3, 2016 · 4 comments
Open

Comments

@tasin-megamind
Copy link

Hi,
I want to manipulate and recognize errors from the requests and response data which are passing through the proxy server.
What are is the proper way of doing that?
It would be nice to if someone explains it step by step.

@jpittis
Copy link
Contributor

jpittis commented Aug 3, 2016

I'm assuming when you say "request and response data" you're referring to HTTP requests and responses. We currently don't have any built in HTTP aware toxics. Though there are plans to add an official one in the future, the present toxic interface makes it possible for you to build one yourself.

@xthexder
Copy link
Contributor

xthexder commented Aug 3, 2016

I spent a little time looking at http toxics in the past, and have an example up here: https://github.com/xthexder/toxic-example/blob/master/http.go
It only modifies responses, but a similar approach could be used for requests.

If you're willing to compile your own toxiproxy binary, this would be the way to go about this currently.

@tasin-megamind
Copy link
Author

thanks for your interest

@jarangutan
Copy link

Sorry to revive an old issue. I saw that the example xthexder created got added here: https://github.com/Shopify/toxiproxy/blob/main/_examples/toxics/http_toxic.go

I also saw the updated doc on using the io.Reader/io.Writer stuff here: https://github.com/Shopify/toxiproxy/blob/main/CREATING_TOXICS.md#using-ioreader-and-iowriter

I can't get the http_toxic example running and much having issues trying to get something working to add a header to a request rather than the response.

If anyone much smarter knows how to get access to the request and can post an example, that'd be much appreciated!

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

4 participants