Issue
If an AppDaemon app is send a POST request with an empty body, the AppDaemon itself will fail with an error 500 "An Error occurred while processing request" before even calling the app. This probably is related to the JSON parsing failing.
Background
In my Caravan, I would like to allow my Laptop to get the current location for web pages like google maps. I already have a home assistant instance running with a sensor supplying GPS coordinates and an App in AppDaemon that will output said coordinates in a format understood by firefox. Setting the geo.provider.network.url to the app endpoint works kindof.
Unfortunately Firefox sends a POST request with an empty body as seen on https://webhook.site/#!/view/dabafb95-bc37-4064-a111-6a1cfdb21b01/b6be3890-766a-451a-8cb6-4836185e41ae .
On
|
args = await request.json() |
, the AppDaemon will always try to parse the body as JSON which obviously fails.
Possible solution?
If you agree to accept this as a bug, a check if there is a body might be a simple fix. Maybe something like
args = await request.json() if request.can_read_body else null
could do the trick?
Issue
If an AppDaemon app is send a POST request with an empty body, the AppDaemon itself will fail with an error 500 "An Error occurred while processing request" before even calling the app. This probably is related to the JSON parsing failing.
Background
In my Caravan, I would like to allow my Laptop to get the current location for web pages like google maps. I already have a home assistant instance running with a sensor supplying GPS coordinates and an App in AppDaemon that will output said coordinates in a format understood by firefox. Setting the
geo.provider.network.urlto the app endpoint works kindof.Unfortunately Firefox sends a POST request with an empty body as seen on https://webhook.site/#!/view/dabafb95-bc37-4064-a111-6a1cfdb21b01/b6be3890-766a-451a-8cb6-4836185e41ae .
On
appdaemon/appdaemon/http.py
Line 968 in 37a33c4
Possible solution?
If you agree to accept this as a bug, a check if there is a body might be a simple fix. Maybe something like
could do the trick?