Content
Will Pearse rombulow Follow V You know how HTTP GET requests are meant to be idempotent? Well, do I have the story for you … a while back I added WiFi control to our garage doors with little Wemos Dis. 2:09 PM – 29 Apr 2018 1,659 Retweets 2,532 Likes 61 17 1.7K 2.5K Will Pearse rombulow Apr 29 The Wemos expose a simple web page with a link that says "Toggle". The endpoint for the link activates a relay, which is hooked up to the push-button on the garage door, which makes the door raiselowerhalt. 9 1 17 24 175 Will Pearse rombulow Apr 29 (This toggle endpoint responds to GET requests. I threw the code together in minutes and was too lazy to spend another couple minutes figuring out POST. regret) 2 17 13 Y 181 Will Pearse rombulow Apr 29 Safari eventually figured out I used this toggle page regularly, so added it to my favourites. Which are iCloud-synced between all my devices. 9 1 17 25 218 Will Pearse rombulow Apr 29 So every time I opened a new tab on my laptop, desktop, iPhone or iPad the garage door opened or closed. Late at night, early in the morning, or randomly throughout the day… 15 27 177 Y 820 Will Pearse rombulow Apr 29 This, kids, is why GET requests should be idempotent. 37 17 221 M 1.2K