|
@@ -45,6 +45,8 @@ var (
|
|
|
worldStatement *sql.Stmt
|
|
|
fortuneStatement *sql.Stmt
|
|
|
updateStatement *sql.Stmt
|
|
|
+
|
|
|
+ helloWorld = []byte("Hello, World!")
|
|
|
)
|
|
|
|
|
|
func main() {
|
|
@@ -83,13 +85,6 @@ func jsonHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
json.NewEncoder(w).Encode(&Message{"Hello, world"})
|
|
|
}
|
|
|
|
|
|
-var HelloWorld = []byte("Hello, World!")
|
|
|
-
|
|
|
-func plaintextHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
- w.Header().Set("Content-Type", "text/plain")
|
|
|
- w.Write(HelloWorld)
|
|
|
-}
|
|
|
-
|
|
|
// Test 2: Single database query
|
|
|
func dbHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
var world World
|
|
@@ -181,6 +176,12 @@ func updateHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// Test 6: Plaintext
|
|
|
+func plaintextHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
+ w.Header().Set("Content-Type", "text/plain")
|
|
|
+ w.Write(helloWorld)
|
|
|
+}
|
|
|
+
|
|
|
type Fortunes []*Fortune
|
|
|
|
|
|
func (s Fortunes) Len() int { return len(s) }
|