1

Given the following code I'd expect the http.ReadRequest to return a valid request which can then be used further. However, I get the following error message: panic: unexpected EOF and I don't know how I can make this work. Thanks in advance for your help!

package main

import (
    "bufio"
    "net/http"
    "strings"
)

func main() {
    s := `GET https://httpbin/get HTTP/1.1`

    req, err := http.ReadRequest(bufio.NewReader(strings.NewReader(s)))

    if err != nil {
        panic(err)
    }

    _ = req

}

https://go.dev/play/p/NLsBW_Vvquw

Alex1234
  • 29
  • 2

0 Answers0