From 2ed2786f8e91ace8e366c1e14c6830fd5442c114 Mon Sep 17 00:00:00 2001 From: Bogdan Constantinescu Date: Fri, 20 Feb 2015 16:54:19 +0200 Subject: [PATCH] gorequest wasn't sending the request for validation In the gorequest Send method, there is a switch that checks the type of the parameter (https://github.com/parnurzeal/gorequest/blob/master/main.go#L341). In this particular case, the type of *IAPRequest is "ptr" which results in gorequest's switch to go the default case which is empty. The request was made with an empty body. --- appstore/validator.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/appstore/validator.go b/appstore/validator.go index dd1fb90..ca19d48 100644 --- a/appstore/validator.go +++ b/appstore/validator.go @@ -99,9 +99,15 @@ func NewWithConfig(config Config) Client { // Verify sends receipts and gets validation result func (c *Client) Verify(req *IAPRequest) (IAPResponse, error) { result := IAPResponse{} + obj, err_json := json.Marshal(req) + if err_json != nil { + return result, fmt.Errorf("%v", err_json) + } + res, body, errs := gorequest.New(). Post(c.URL). - Send(req). + Type("json"). + SendString(string(obj)). Timeout(c.TimeOut). End()