lnbits icon indicating copy to clipboard operation
lnbits copied to clipboard

FastAPI branch: sometimes a HTML repsonse returned in API

Open cryptoteun opened this issue 3 years ago • 1 comments

I performed some tests on the FastAPI branch and sometimes I get a HTML response instead of a json.

Some examples: lnurlp

POST /lnurlp/api/v1/links
body: {}
Response = HTML
POST /lnurlp/api/v1/links
body: {}
Response = HTML
POST /lnurlp/api/v1/links
body: valid request
Response = Json, lnurlp 9 created: but strange thing with this tag:    "lnurl": {} (will raise separate issue)

When I try to retrieve lnurlp via: GET /lnurlp/api/v1/links/9 HTML response with error:

'PayLink' object has no attribute '_asdict'

lnurlw

POST /withdraw/api/v1/links
body: {}
Response = HTML

POST /withdraw/api/v1/links
body: some missing fields
Response = HTML
POST /withdraw/api/v1/links
body: valid request
Response = HTML response which doesn't conain an error

paywall

POST /paywall/api/v1/paywalls
body: {}
Response = HTML

POST /paywall/api/v1/paywalls
body: some missing fields
Response = HTML
POST /paywall/api/v1/paywalls
body: valid request
Response = Json

cryptoteun avatar Dec 08 '21 21:12 cryptoteun

Just tested on https://github.com/lnbits/lnbits-legend/commit/09bfa35cd5c4e5921a76f62a9df16904218b32a2

Curl example curl -X GET https://fast.laisee.org/api/v1/links/<withdraw_id> -H "X-Api-Key: "

on latest main and it still returns HTML and not json data

Curl example on List all withdraw links works however GET /withdraw/api/v1/links

bitkarrot avatar Jan 25 '22 00:01 bitkarrot