This is a fork of: https://github.com/roglew/puppy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
612 B

package puppy
import (
"runtime"
"testing"
)
func testReq() *ProxyRequest {
testReq, _ := ProxyRequestFromBytes(
[]byte("POST /?foo=bar HTTP/1.1\r\nFoo: Bar\r\nCookie: cookie=choco\r\nContent-Length: 7\r\n\r\nfoo=baz"),
"foobaz",
80,
false,
)
testRsp, _ := ProxyResponseFromBytes(
[]byte("HTTP/1.1 200 OK\r\nSet-Cookie: cockie=cocks\r\nContent-Length: 4\r\n\r\nBBBB"),
)
testReq.ServerResponse = testRsp
return testReq
}
func testErr(t *testing.T, err error) {
if err != nil {
_, f, ln, _ := runtime.Caller(1)
t.Errorf("Failed test with error at %s:%d. Error: %s", f, ln, err)
}
}