fix get and post by moving request creation to individual functions