# File lib/couchrest.rb, line 141
    def put(uri, doc = nil)
      payload = doc.to_json if doc
      begin
        JSON.parse(RestClient.put(uri, payload))
      rescue Exception => e
        if $COUCHREST_DEBUG == true
          raise "Error while sending a PUT request #{uri}\npayload: #{payload.inspect}\n#{e}"
        else
          raise e
        end
      end
    end