Skip to content

Instantly share code, notes, and snippets.

@dannyc5
Last active November 29, 2016 23:26
Show Gist options
  • Save dannyc5/a9d99cb11dc321910c7086a9b3f1f668 to your computer and use it in GitHub Desktop.
Save dannyc5/a9d99cb11dc321910c7086a9b3f1f668 to your computer and use it in GitHub Desktop.

Responsibilities:

  • make http req
    • GET
      • MUST SUPPORT QUERY PARAMS
    • POST
      • METHOD POST WITH DATA BODY, MUST SUPPORT QUERY PARAMS
    • PATCH
      • METHOD PATCH WITH DATA BODY
    • DELETE
      • METHOD DELETE, NO BODY
  • returns promise with response [status, header, body] to caller
  • know enough to authenticate
  • create default headers
    • create interface: addDefaultHeader
    • call addDefaultHeader in constructor
  • How to handle multiple requests with same instance
    • Make new request object on every request call
    • Pass in default headers to new req obj
  • Port library to other applications
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment