Refactor setting curl headers in `send` routine.

Fix not freeing headers memory, not refreshing on reauth.
Small refactoring, fix bug with duplicate tenantid
Fix memory leak in `auth` routine
Merge pull request #21 from rampage644/memory

Memory