Move http header generation to httppost method