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.
This commit is contained in:
Bogdan Constantinescu
2015-02-20 16:54:19 +02:00
parent a56016b9f8
commit 2ed2786f8e

View File

@@ -99,9 +99,15 @@ func NewWithConfig(config Config) Client {
// Verify sends receipts and gets validation result // Verify sends receipts and gets validation result
func (c *Client) Verify(req *IAPRequest) (IAPResponse, error) { func (c *Client) Verify(req *IAPRequest) (IAPResponse, error) {
result := IAPResponse{} result := IAPResponse{}
obj, err_json := json.Marshal(req)
if err_json != nil {
return result, fmt.Errorf("%v", err_json)
}
res, body, errs := gorequest.New(). res, body, errs := gorequest.New().
Post(c.URL). Post(c.URL).
Send(req). Type("json").
SendString(string(obj)).
Timeout(c.TimeOut). Timeout(c.TimeOut).
End() End()