mirror of
https://github.com/buger/goreplay.git
synced 2024-04-21 12:32:02 +00:00
Unify all input/output plugins
This commit is contained in:
+6
-2
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/base64"
|
||||
"time"
|
||||
)
|
||||
|
||||
// TestInput used for testing purpose, it allows emitting requests on demand
|
||||
@@ -20,9 +21,12 @@ func NewTestInput() (i *TestInput) {
|
||||
|
||||
func (i *TestInput) Read(data []byte) (int, error) {
|
||||
buf := <-i.data
|
||||
copy(data, buf)
|
||||
|
||||
return len(buf), nil
|
||||
header := payloadHeader(RequestPayload, uuid(), time.Now().UnixNano())
|
||||
copy(data[0:len(header)], header)
|
||||
copy(data[len(header):], buf)
|
||||
|
||||
return len(buf) + len(header), nil
|
||||
}
|
||||
|
||||
// EmitGET emits GET request without headers
|
||||
|
||||
Reference in New Issue
Block a user