refactored http validation into its own method