Skip to content

Instantly share code, notes, and snippets.

@AndrewVos
Created July 1, 2014 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndrewVos/ade057714ab862ea5e72 to your computer and use it in GitHub Desktop.
Save AndrewVos/ade057714ab862ea5e72 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", CreateHandler)
http.ListenAndServe(":8000", nil)
}
func CreateHandler(rw http.ResponseWriter, req *http.Request) {
if req.Method != "POST" {
rw.WriteHeader(http.StatusBadRequest)
rw.Write([]byte("KO"))
}
fmt.Println("Creating Lead (", http.StatusCreated, ")")
rw.WriteHeader(http.StatusCreated)
rw.Write([]byte("OK"))
fmt.Println("Header Size: ", len(rw.Header()))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment