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