refactor the Request constructor

add some helper functions, and organize other helper functions
move most of the request js helpers into the helpers file
Add back some missing code, remove duplicate lines.
add comments to request constructor and helper functions
use self in constructor for consistency
remove tiny white space
add braces to my conditionals :)
Split control statements onto separate lines and add braces
Merge pull request #1103 from seanstrom/support/refactor-request-constructor

Support/refactor request constructor