Merge pull request #95 from jfmyers9/fix-respond-with-ptr

Fix RespondWithJSONEncodedPtr
diff --git a/ghttp/handlers.go b/ghttp/handlers.go
index 424dab5..143d2cb 100644
--- a/ghttp/handlers.go
+++ b/ghttp/handlers.go
@@ -196,9 +196,9 @@
 Also, RespondWithJSONEncodedPtr can be given an optional http.Header.  The headers defined therein will be added to the response headers.
 Since the http.Header can be mutated after the fact you don't need to pass in a pointer.
 */
-func RespondWithJSONEncodedPtr(statusCode *int, object *interface{}, optionalHeader ...http.Header) http.HandlerFunc {
+func RespondWithJSONEncodedPtr(statusCode *int, object interface{}, optionalHeader ...http.Header) http.HandlerFunc {
 	return func(w http.ResponseWriter, req *http.Request) {
-		data, err := json.Marshal(*object)
+		data, err := json.Marshal(object)
 		Ω(err).ShouldNot(HaveOccurred())
 		if len(optionalHeader) == 1 {
 			copyHeader(optionalHeader[0], w.Header())
diff --git a/ghttp/test_server_test.go b/ghttp/test_server_test.go
index 31a2053..288ef55 100644
--- a/ghttp/test_server_test.go
+++ b/ghttp/test_server_test.go
@@ -575,12 +575,16 @@
 		})
 
 		Describe("RespondWithJSONPtr", func() {
+			type testObject struct {
+				Key   string
+				Value string
+			}
+
 			var code int
-			var object interface{}
+			var object testObject
 			BeforeEach(func() {
 				code = http.StatusOK
-				object = []int{1, 2, 3}
-
+				object = testObject{}
 				s.AppendHandlers(CombineHandlers(
 					VerifyRequest("POST", "/foo"),
 					RespondWithJSONEncodedPtr(&code, &object),
@@ -589,7 +593,10 @@
 
 			It("should return the response", func() {
 				code = http.StatusCreated
-				object = []int{4, 5, 6}
+				object = testObject{
+					Key:   "Jim",
+					Value: "Codes",
+				}
 				resp, err = http.Post(s.URL()+"/foo", "application/json", nil)
 				Ω(err).ShouldNot(HaveOccurred())
 
@@ -597,7 +604,7 @@
 
 				body, err := ioutil.ReadAll(resp.Body)
 				Ω(err).ShouldNot(HaveOccurred())
-				Ω(body).Should(MatchJSON("[4,5,6]"))
+				Ω(body).Should(MatchJSON(`{"Key": "Jim", "Value": "Codes"}`))
 			})
 		})
 	})