My Delete Handler: (I am using "github.com/gorilla/mux")
func DeletePerson(w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
item := params["id"]
fmt.Println("Item = ", item)
...
returns Item = "2" when called by the following curl command:
curl -X DELETE http://localhost:8000/address/2
However, my TEST Code:
func TestDeletePerson(t *testing.T) {
person := &Person{
UniqID: "2",
FirstName: "",
LastName: "",
EmailAddr: "",
PhoneNumb: "",
}
jsonPerson, _ := json.Marshal(person)
request, _ := http.NewRequest("DELETE", "/address/2", bytes.NewBuffer(jsonPerson))
response := httptest.NewRecorder()
DeletePerson(response, request)
Results in DeletePerson returning "" and printing "params" directly returns
map[]
Big Question - WHAT IN HELL AM I MISSING???
Is there another header parameter I have set?