mirror of
https://github.com/buger/goreplay.git
synced 2024-04-21 12:32:02 +00:00
Filter HTTP methods on output
Add a new CLI flag to specify which HTTP methods should be replayed by HTTPOutput. If specified, any requests not matching will be dropped. This can be useful for replaying requests against stateful environments. e.g. You may not want to reproduce POST requests against an application if it results in additional calls to the outside world. Some variations I considered: - Filtering on input instead of output. However we don't currently do any request parsing on input, and doing so would likely have an impact on performance. - A request filtering plugin. We might want to revisit this if we add anymore options to HTTPOutput. It could also be used to modify requests in an existing file capture. Although because all plugins expect byte slices we'd potentially have to parse requests more than once. I don't think this warrants a separate test for HTTPOutput yet. But, again, if we add anymore then we should split them out, and DRY up if possible. Because we don't want to overload the scenarios covered by that one test.
This commit is contained in:
@@ -26,6 +26,10 @@ func (i *TestInput) EmitPOST() {
|
||||
i.data <- []byte("POST /pub/WWW/ HTTP/1.1\nHost: www.w3.org\r\n\r\na=1&b=2\r\n\r\n")
|
||||
}
|
||||
|
||||
func (i *TestInput) EmitOPTIONS() {
|
||||
i.data <- []byte("OPTIONS / HTTP/1.1\nHost: www.w3.org\r\n\r\n")
|
||||
}
|
||||
|
||||
func (i *TestInput) String() string {
|
||||
return "Test Input"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user