more debug with http.go
parent
6bbb9861ef
commit
25e99fbf93
|
|
@ -1,6 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
|
@ -8,7 +10,13 @@ import (
|
|||
func main() {
|
||||
p := os.Getenv("PORT")
|
||||
if err := http.ListenAndServe(":"+p, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte(os.Getenv("BODY")))
|
||||
b, _ := io.ReadAll(r.Body)
|
||||
log.Printf("> %s", b)
|
||||
body := os.Getenv("BODY")
|
||||
if body == "-" {
|
||||
body = string(b)
|
||||
}
|
||||
w.Write([]byte(body))
|
||||
})); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue