The canonical body. This could be an IO object (such as +#body_stream+),
 an actual string (such as +#body+), or just the empty string if the
 request's body and stream was nil.

 @return [String, IO]
511537
def content_hash
      return @content_hash if @content_hash

      if SIGN_FULL_BODY
        @content_hash = hash(@body || '').chomp
      else
        if @body.is_a?(Multipart::MultiIO)
          filepart = @body.ios.find { |io| io.is_a?(Multipart::MultiIO) }
          file     = filepart.ios.find { |io| !io.is_a?(StringIO) }

          @content_hash = hash(file).chomp
        else
          @content_hash = hash(@body || '').chomp
        end
      end

      @content_hash
    end
614919
def decode_body(headers: MutableMapping, body: bytes) -> dict:
    

    type_, encoding = parse_content_type(headers)
    decoded_body = body.decode(encoding)

    # There is one api that just returns `ok` instead of json. In order to have a consistent API we decided to modify the returned payload into a dict.
    if type_ == "application/json":
        payload = json.loads(decoded_body)
    else:
        if decoded_body == "ok":
            payload = {"ok": True}
        else:
            payload = {"ok": False, "data": decoded_body}

    return payload
779204
def to_xml(body)
        root = @api_options[:root_element].nil? ? 'Request' : @api_options[:root_element]
        body.to_xml(root: root, skip_instruct: true, skip_types: true)
      end
532247
private byte[] readBody(Map<String, List<String>> headers, WebSocketInputStream input)
    {
        // Get the value of "Content-Length" header.
        int length = getContentLength(headers);

        if (length <= 0)
        {
            // Response body is not available.
            return null;
        }

        try
        {
            // Allocate a byte array of the content length.
            byte[] body = new byte[length];

            //  into the byte array.
            input.readBytes(body, length);

            // Return the content of the response body.
            return body;
        }
        catch (Throwable t)
        {
            // Response body is not available.
            return null;
        }
    }
508844
def body_lazy(value)
      process_body_raw if @body_raw && value
      case
      when value == nil || value.length<=0
        @body = Mail::Body.new('')
        @body_raw = nil
        add_encoding_to_body
      when @body && @body.multipart?
        self.text_part = value
      else
        @body_raw = value
      end
    end
231747
def parse(body)
      body.is_a?(String) ? JSON.parse(body) : body
    rescue JSON::ParserError
      {}
    end
135349
def object_to_http_body(model)
      return if model.nil?
      _body = nil
      if model.is_a?(Array)
        _body = model.map{|m| object_to_hash(m) }
      else
        _body = object_to_hash(model)
      end
      _body.to_json
    end
212128
def parse_body(body)
      format = determine_format(@options[:parse])
      case format
      when :json
        unless ::Boson::Util.safe_require 'json'
          return puts("Install the json gem to parse json: sudo gem install json")
        end
        JSON.parse body
      when :yaml
        YAML::load body
      else
        puts "Can't parse this format."
      end
    rescue
      @options[:raise_error] ? raise : puts("Error while parsing #{format} response of '#{@url}': #{$!.class}")
    end
1330536
def getBody(cls, url, method='GET', headers={}, data=None, socket=None, timeout=120):
        
        if not 'User-Agent' in headers:
            headers['User-Agent'] = ['Tensor HTTP checker']

        return cls().request(url, method, headers, data, socket, timeout)
614364
def body(self):
        
        body, _, is_markdown = self._entry_content
        return TrueCallableProxy(
            self._get_markup,
            body,
            is_markdown) if body else CallableProxy(None)
496841
def body
      raise RequestError, 'The request requires a HTTP method.' unless @http_method
      raise RequestError, 'The payload needs to be a hash.' unless @payload.to_s.empty? || @payload.is_a?(Hash)

      res = Net::HTTP.start(uri.hostname, Yoti.configuration.api_port, use_ssl: https_uri?) do |http|
        signed_request = SignedRequest.new(unsigned_request, path, @payload).sign
        http.request(signed_request)
      end

      raise RequestError, "Unsuccessful Yoti API call: #{res.message}" unless res.code == '200'

      res.body
    end
496937
def request(post_body, headers)
      response = @client.post(endpoint, post_body, headers)
      return { :status => response.status, :body => response.content, :content_type => response.contenttype }
    end
165037
def request(uri, method = :get, body = nil, query = nil, content_type = nil)
      headers = {}

      {
        'Content-Type'                  => content_type || 'application/json',
        'User-Agent'                    => "Parse for Ruby, #{VERSION}",
        Protocol::HEADER_MASTER_KEY     => @master_key,
        Protocol::HEADER_APP_ID         => @application_id,
        Protocol::HEADER_API_KEY        => @api_key,
        Protocol::HEADER_SESSION_TOKEN  => @session_token
      }.each do |key, value|
        headers[key] = value if value
      end

      uri = ::File.join(path, uri)
      response = @session.send(method, uri, query || body || {}, headers)
      response.body

    # NOTE: Don't leak our internal libraries to our clients.
    # Extend this list of exceptions as needed.
    rescue Faraday::Error::ClientError => e
      raise Parse::ConnectionError, e.message
    end
316343
@Override
    public HttpOutputStreamImpl getBody() {
        if (null == this.body) {
            if (HttpDispatcher.useEE7Streams()) {
                this.body = new HttpOutputStreamEE7(this.isc);
            } else {
                this.body = new HttpOutputStreamImpl(this.isc);
            }
            this.body.setVirtualConnection(this.connlink.getVirtualConnection());
            if (this.message != null) {
                long messageContentLength = getContentLength();
                if (messageContentLength != -1) { //it's set
                    this.body.setContentLength(getContentLength());
                }
            }
        }
        return this.body;
    }
851421
def body(self):
        
        if not self._auto_decode:
            return self._body
        if 'body' in self._decode_cache:
            return self._decode_cache['body']
        body = try_utf8_decode(self._body)
        self._decode_cache['body'] = body
        return body
1128986
def fetch
      body = get(Nominatim.config.reverse_url, @criteria).body
      return nil if body.empty?
      Nominatim::Place.new(body)
    end
73975
def parse_body(buf)
      if self[:total_body_length] < 1
        buf, rest = "", buf
      else
        buf, rest = buf[0..(self[:total_body_length] - 1)], buf[self[:total_body_length]..-1]
      end

      if self[:extras_length] > 0
        self[:extras] = parse_extras(buf[0..(self[:extras_length]-1)])
      else
        self[:extras] = parse_extras("")
      end
      if self[:key_length] > 0
        self[:key] = buf[self[:extras_length]..(self[:extras_length]+self[:key_length]-1)]
      else
        self[:key] = ""
      end
      self[:value] = buf[(self[:extras_length]+self[:key_length])..-1]

      rest
    end