From bb35e9f2a808458162a9c03a15f488ec58143849 Mon Sep 17 00:00:00 2001 From: Junpei Tsuji Date: Thu, 20 Feb 2020 14:03:07 +0900 Subject: [PATCH] Handle http status 5xx error --- appstore/model.go | 1 - appstore/validator.go | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/appstore/model.go b/appstore/model.go index 677e701..c795289 100644 --- a/appstore/model.go +++ b/appstore/model.go @@ -163,7 +163,6 @@ type ( SubscriptionRetryFlag string `json:"is_in_billing_retry_period,omitempty"` } - // The HttpStatusResponse struct contains the status code returned by the store // Used as a workaround to detect when to hit the production appstore or sandbox appstore regardless of receipt type StatusResponse struct { diff --git a/appstore/validator.go b/appstore/validator.go index f7b15d5..1ce27e7 100644 --- a/appstore/validator.go +++ b/appstore/validator.go @@ -125,7 +125,7 @@ func (c *Client) Verify(ctx context.Context, reqBody IAPRequest, result interfac } defer resp.Body.Close() if resp.StatusCode >= 500 { - return fmt.Errorf("Received http status code %d from the App Store: %w", resp.StatusCode, ErrAppStoreServer) + return "", fmt.Errorf("Received http status code %d from the App Store: %w", resp.StatusCode, ErrAppStoreServer) } return c.parseResponse(resp, result, ctx, reqBody) }