mirror of
https://github.com/getAlby/lndhub.go.git
synced 2026-01-24 07:16:12 +01:00
Fix request body
This commit is contained in:
@@ -10,19 +10,18 @@ type PayInvoiceController struct{}
|
||||
|
||||
// PayInvoice : Pay invoice Controller
|
||||
func (PayInvoiceController) PayInvoice(c echo.Context) error {
|
||||
var body struct {
|
||||
ID uint `json:"id"`
|
||||
var reqBody struct {
|
||||
Invoice string `json:"invoice" validate:"required"`
|
||||
Amount int `json:"amount" validate:"gt=0"`
|
||||
}
|
||||
|
||||
if err := c.Bind(&body); err != nil {
|
||||
if err := c.Bind(&reqBody); err != nil {
|
||||
return c.JSON(http.StatusBadRequest, echo.Map{
|
||||
"message": "failed to bind json",
|
||||
})
|
||||
}
|
||||
|
||||
if err := c.Validate(&body); err != nil {
|
||||
if err := c.Validate(&reqBody); err != nil {
|
||||
return c.JSON(http.StatusBadRequest, echo.Map{
|
||||
"message": "invalid request",
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user