lib/http.js: Refactor validateRequest()