[BUG] GetCurlCommand() can't get the request host
linuxsong opened this issue ยท comments
Describe the bug
GetCurlCommand()
can not get the request host.
To Reproduce
package main
import (
"fmt"
"net/http"
"moul.io/http2curl"
)
func greet(w http.ResponseWriter, r *http.Request) {
command, _ := http2curl.GetCurlCommand(r)
fmt.Fprintf(w, command.String())
}
func main() {
http.HandleFunc("/", greet)
http.ListenAndServe(":8080", nil)
}
$ curl --location --request GET 'http://127.0.0.1:8080/'
Output: curl -X 'GET' -d '' -H 'Accept: */*' -H 'User-Agent: curl/7.77.0' '/'
Expect output: curl -X 'GET' -d '' -H 'Accept: */*' -H 'User-Agent: curl/7.77.0' 'http://127.0.0.1:8080/'
๐ This issue has been resolved in version 2.3.0 ๐
The release is available on GitHub release
Your semantic-release bot ๐ฆ๐