extract method to write request to http output stream
KBASE-1016 #comment adding length param to req doesn't cause problem