我想打印出我已经做过的xml响应,而不是问好打印出整个响应的人都知道我该怎么做?
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/hello", hello)
http.ListenAndServe(":9090", nil)
}
func hello(w http.ResponseWriter, req *http.Request) {
w.Header().Set("Content-Type", "application/xml")
fmt.Fprintf(w, "hello\n")
}