Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON delivery by REST api for items ends prematurely #284

Open
cee-dee opened this issue Nov 2, 2019 · 0 comments
Open

JSON delivery by REST api for items ends prematurely #284

cee-dee opened this issue Nov 2, 2019 · 0 comments

Comments

@cee-dee
Copy link

cee-dee commented Nov 2, 2019

Accessing https://myopenhab.org/api/items (after a login) from Firefox 70.0, Chrome 78.0.3904.87 and curl delivers an incomplete JSON datastream, i.e. ending on something like ... "editable":false,"type":"DateTime","name":"IcurrentDate","la. In consequence any JSON parser will fail interpreting the response.

This problem seems to occur less if the data being transferred is reduced, i.e. if there are fewer items, chances are higher that a retry will deliver a complete and valid JSON.

According to openhab/openhab-alexa#253 this is a known issue and the Alexa skill developers tried to work around the issue using a 3-retries-method. For me, this still does not work -- maybe due to my many items in openHAB.

With 20 retries I could get https://myopenhab.org/api/items to deliver a 256KB JSON with my items (already a stripped down version).

Here are the headers of request and response in Firefox:

Request:

Accept | text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding | gzip, deflate, br
Accept-Language | de,en-US;q=0.7,en;q=0.3
Cache-Control | max-age=0
Connection | keep-alive
Host | myopenhab.org
Upgrade-Insecure-Requests | 1
User-Agent | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0

Response:
Connection | keep-alive
Content-Type | application/json
Date | Sat, 02 Nov 2019 16:38:56 GMT
Server | nginx/1.10.3 (Ubuntu)
Transfer-Encoding | chunked
X-Powered-By | Express
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant