Article 63D0J CodeSOD: Oh, Poop

CodeSOD: Oh, Poop

by
Remy Porter
from The Daily WTF on (#63D0J)

Pearl was paying down some technical debt. She was trawling through their NodeJS application with a search for TODO and console.log. She was triaging the TODOs, and replacing the logs with a real logging framework.

The application was old, had many complicated routes for requests to be handled, and buried deep in a file was this code, which was clearly testing code that was never meant to end up in production:

var express = require("express");var router = express.Router();/* GET home page. */router.post(poopRoute, function (req, res, next) { const { poop, despacito } = req.body; console.log(poop); console.log(despacito); const ok = "ok"; return res.json({ ok, poop, despacito });});module.exports = router;

Poop indeed. It was obviously easy for Pearl to just remove this code, its potty humor, and it's completely not dated pop-culture reference from 2017. But the funniest part of this code, for me, is that the comment tells us that it's a GET request, when the code tells us it's a POST request. The mismatch is so sad. Alexa, play Despacito.

otter-icon.png [Advertisement] Continuously monitor your servers for configuration changes, and report when there's configuration drift. Get started with Otter today!
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments