@@ -194,14 +194,14 @@ func runResetLinkingLimit(cmd *cobra.Command, args []string) error {
194194 return nil
195195}
196196
197- type subsSearchResult struct {
197+ type activeSubsResp struct {
198198 Email string `json:"email"`
199199 OrderID string `json:"order_id"`
200200 ProductName string `json:"product_name"`
201201}
202202
203- type subsSearchResp struct {
204- Results []subsSearchResult `json:"results"`
203+ type activeSubsListResp struct {
204+ Results []activeSubsResp `json:"results"`
205205}
206206
207207func resolveOrderIDByEmail (ctx context.Context , client * http.Client , baseURL , email , token string ) (string , error ) {
@@ -225,11 +225,14 @@ func resolveOrderIDByEmail(ctx context.Context, client *http.Client, baseURL, em
225225 }
226226
227227 if resp .StatusCode != http .StatusOK {
228- body , _ := io .ReadAll (io .LimitReader (resp .Body , 4096 ))
228+ body , err := io .ReadAll (io .LimitReader (resp .Body , 4096 ))
229+ if err != nil {
230+ return "" , fmt .Errorf ("unexpected status %d: failed to read response body: %w" , resp .StatusCode , err )
231+ }
229232 return "" , fmt .Errorf ("unexpected status %d: %s" , resp .StatusCode , body )
230233 }
231234
232- var result subsSearchResp
235+ var result activeSubsListResp
233236 if err := json .NewDecoder (resp .Body ).Decode (& result ); err != nil {
234237 return "" , fmt .Errorf ("failed to decode response: %w" , err )
235238 }
0 commit comments