Issue: IFTTT Maker PUT Webhook 404

Hoping some of the devs who are more familiar with the gateway than I can have a look at the issue below related to the IFTTT webhook not able to issue put commands to the Mozilla-IOT Gateway from IFTTT.

It looks like the logic for treating incoming requests to the api isn’t optimal which causes PUT requests to be handled as GUI requests because the IFTTT webhook does not add the accepts: application/json header to the request. I altered the logic as below to examine/handle the content-type header for application/json assuming that if this header is present then it will be an api request and it seems to have resolve the issue.

If it looks ok, Ill issue a pull request as I found the IFTTT hook good for bridging RING cameras. Note I’ve also just finished authoring a RING ADAPTER and will share once I’ve refactored and tested it.

// If request won’t accept HTML but will accept JSON,
+// or has a content-type of JSON
// or is a WebSocket request, or is multipart/form-data
// treat it as an API request
} else if (!request.accepts(‘html’) && request.accepts(‘json’) ||
+request.headers[‘content-type’] === ‘application/json’ ||
request.get(‘Upgrade’) === ‘websocket’ ||
request.is(‘multipart/form-data’) ||
request.path.startsWith(Constants.ADDONS_PATH) ||