Added support for io.ReadAll on requests
All checks were successful
/ test (push) Successful in 18s

This commit is contained in:
Eduard Urbach 2025-06-21 11:37:39 +02:00
parent 9a781d2e64
commit 4c19cd0e99
Signed by: eduard
GPG key ID: 49226B848C78F6C8
4 changed files with 65 additions and 18 deletions

View file

@ -78,7 +78,7 @@ func (s *server) Ready() chan struct{} {
func (s *server) Request(method string, url string, headers []Header, body io.Reader) Response {
ctx := s.newContext()
ctx.request.headers = headers
ctx.request.Reader.Reset(body)
ctx.request.reader.Reset(body)
s.handleRequest(ctx, method, url, io.Discard)
return ctx.Response()
}
@ -133,14 +133,14 @@ func (s *server) handleConnection(conn net.Conn) {
close bool
)
ctx.Reader.Reset(conn)
ctx.reader.Reset(conn)
defer conn.Close()
defer s.contextPool.Put(ctx)
for !close {
// Read the HTTP request line
message, err := ctx.Reader.ReadString('\n')
message, err := ctx.reader.ReadString('\n')
if err != nil {
return
@ -177,7 +177,7 @@ func (s *server) handleConnection(conn net.Conn) {
// Add headers until we meet an empty line
for {
message, err = ctx.Reader.ReadString('\n')
message, err = ctx.reader.ReadString('\n')
if err != nil {
return