package main import ( "fmt" "net/http" "net/http/httptest" ) func helloHandler(w http.ResponseWriter, r *http.Request) { // TODO: write "Hello, Go!" to w using fmt.Fprint } func main() { req, _ := http.NewRequest("GET", "/", nil) rec := httptest.NewRecorder() helloHandler(rec, req) fmt.Println("Status:", rec.Code) fmt.Println("Body:", rec.Body.String()) }
Output
Click Run to execute, or Check to validate.
Community Chat
Ask a question β uByte AI answers instantly
Loading messagesβ¦
Sign in to ask questions
Shift+Enter for new line Β· Enter to send