witnessmenow / esp8266-alexa-wemo-emulator

multiple belkin wemos switch emulator using ESP8266
GNU General Public License v2.0
132 stars 43 forks source link

String.indexOf returns -1(!) if not found #7

Open UlliBien opened 7 years ago

UlliBien commented 7 years ago
  1. You use "if(request.indexOf('M-SEARCH') > 0) ..." this is false if 'M-SEARCH' is at the beginning of a string. Use "if(request.indexOf('M-SEARCH') > -1)" instead. There are other occurrences of this.

  2. indexOf('M-SEARCH') only looks for 'M' and not for 'M-SEARCH'. Use "M-SEARCH" instead (with double quotes).

witnessmenow commented 7 years ago

Thanks for letting me know. I am crazy busy for the next few weeks and will only be able to get to it then. Would you be able submit a PR before that?