Created
July 1, 2014 15:16
-
-
Save AndrewVos/ade057714ab862ea5e72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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