getAlby / lndhub.go

Accounting wrapper for the Lightning Network. It provides separate accounts for end-users. (LndHub compatible API written in Go)
GNU General Public License v3.0
86 stars 23 forks source link

more accurate http status codes for keysend #280

Closed kiwiidb closed 1 year ago

kiwiidb commented 1 year ago

Fixes #270 Tested locally.

➜  Alby http POST localhost:3000/v2/payments/keysend < keysend.json Authorization:"Bearer $token"
HTTP/1.1 400 Bad Request
Content-Length: 110
Content-Type: application/json; charset=UTF-8
Date: Mon, 09 Jan 2023 14:02:42 GMT
X-Request-Id: vddq9Yq3JPt5gYj5QSGk91cpcL4NYWye

{
    "code": 8,
    "error": true,
    "message": "Internal keysend payments require the custom record 696969 to be present."
}

Other endpoints can also be updated to use the status code from ErrorResponse to improve the accuracy of the http status code returned. However this should be for another PR.