added content-length handling for put and post