bencouture / denon-rest-api

A REST front-end for controlling Denon receivers
MIT License
57 stars 17 forks source link

Errors when valid command is sent and run #2

Open intrepidsilence opened 3 years ago

intrepidsilence commented 3 years ago

Thanks so much for writing this little project. I plan to use this with iOS Shortcuts to add Siri commands to control various parts of my AVR, which will be very nice.

I am seeing an error though. I am probably just doing something silly, but would appreciate some help if it is just me not knowing what I am doing :) .

When I run a wget with a valid command, I see the AVR do what is expected but I also get a JS error on the server side (your code): RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: 1 at ServerResponse.writeHead (_http_server.js:211:11) at ServerResponse._implicitHeader (_httpserver.js:202:8) at write (_http_outgoing.js:585:9) at ServerResponse.end (_http_outgoing.js:702:5) at ServerResponse.send (/root/denon-rest-api/node_modules/express/lib/response.js:221:10) at /root/denon-rest-api/lib/server.js:28:14 at Layer.handle [as handle_request] (/root/denon-rest-api/node_modules/express/lib/router/layer.js:95:5) at next (/root/denon-rest-api/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/root/denon-rest-api/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/root/denon-rest-api/node_modules/express/lib/router/layer.js:95:5)

The wget command also sees that there was an error and keeps sending the same request over and over again.

An example of the command I sent: wget http://marantzapi.domain.com:8080/api/PSDYNEQOFF

And here are the errors that wget spits out: --2021-01-30 12:59:37-- http://marantzapi.domain.com:8080/api/PSDYNEQ%20OFF Resolving marantzapi.domain.com (marantzapi.domain.com)... 192.168.15.190 Connecting to marantzapi.domain.com (marantzapi.domain.com)|192.168.15.190|:8080... connected. HTTP request sent, awaiting response... No data received. Retrying.

Thanks in advance!

buzink commented 2 years ago

Same here. When for example visiting http://192.168.2.79:8000/api/PWSTANDBY in browser I get:

RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: 1
   at ServerResponse.writeHead (_http_server.js:246:11)
   at ServerResponse._implicitHeader (_http_server.js:237:8)
   at write_ (_http_outgoing.js:659:9)
   at ServerResponse.end (_http_outgoing.js:776:5)
   at ServerResponse.send (/Users/buzink/denon-rest-api/node_modules/express/lib/response.js:204:10)
   at /Users/buzink/denon-rest-api/lib/server.js:28:14
   at Layer.handle [as handle_request] (/Users/buzink/denon-rest-api/node_modules/express/lib/router/layer.js:95:5)
   at next (/Users/buzink/denon-rest-api/node_modules/express/lib/router/route.js:131:13)
   at Route.dispatch (/Users/buzink/denon-rest-api/node_modules/express/lib/router/route.js:112:3)
   at Layer.handle [as handle_request] (/Users/buzink/denon-rest-api/node_modules/express/lib/router/layer.js:95:5)

Still, the command works.

buzink commented 2 years ago

This issue is fixed by davidcreager in his fork of of the denon-rest-api