show klarna body on error
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -48,6 +49,11 @@ func (k *KlarnaClient) GetOrder(orderId string) (*CheckoutOrder, error) {
|
|||||||
}
|
}
|
||||||
return &klarnaOrderResponse, nil
|
return &klarnaOrderResponse, nil
|
||||||
}
|
}
|
||||||
|
body, err := io.ReadAll(res.Body)
|
||||||
|
if err == nil {
|
||||||
|
log.Println(string(body))
|
||||||
|
}
|
||||||
|
|
||||||
return nil, fmt.Errorf(res.Status)
|
return nil, fmt.Errorf(res.Status)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,6 +77,10 @@ func (k *KlarnaClient) CreateOrder(reader io.Reader) (*CheckoutOrder, error) {
|
|||||||
err = json.NewDecoder(res.Body).Decode(&klarnaOrderResponse)
|
err = json.NewDecoder(res.Body).Decode(&klarnaOrderResponse)
|
||||||
return &klarnaOrderResponse, err
|
return &klarnaOrderResponse, err
|
||||||
}
|
}
|
||||||
|
body, err := io.ReadAll(res.Body)
|
||||||
|
if err == nil {
|
||||||
|
log.Println(string(body))
|
||||||
|
}
|
||||||
return nil, fmt.Errorf(res.Status)
|
return nil, fmt.Errorf(res.Status)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,6 +104,10 @@ func (k *KlarnaClient) UpdateOrder(orderId string, reader io.Reader) (*CheckoutO
|
|||||||
err = json.NewDecoder(res.Body).Decode(&klarnaOrderResponse)
|
err = json.NewDecoder(res.Body).Decode(&klarnaOrderResponse)
|
||||||
return &klarnaOrderResponse, err
|
return &klarnaOrderResponse, err
|
||||||
}
|
}
|
||||||
|
body, err := io.ReadAll(res.Body)
|
||||||
|
if err == nil {
|
||||||
|
log.Println(string(body))
|
||||||
|
}
|
||||||
return nil, fmt.Errorf(res.Status)
|
return nil, fmt.Errorf(res.Status)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user