Parse the body of an object response and populate the object.
199798
def _parse_body(self, robj, response, expected_statuses):
        
        # If no response given, then return.
        if response is None:
            return None

        status, headers, data = response

        # Check if the server is down(status==0)
        if not status:
            m = 'Could not contact Riak Server: http://{0}:{1}!'.format(
                self._node.host, self._node.http_port)
            raise RiakError(m)

        # Make sure expected code came back
        self.check_http_code(status, expected_statuses)

        if 'x-riak-vclock' in headers:
            robj.vclock = VClock(headers['x-riak-vclock'], 'base64')

        # If 404(Not Found), then clear the object.
        if status == 404:
            robj.siblings = []
            return None
        # If 201 Created, we need to extract the location and set the
        # key on the object.
        elif status == 201:
            robj.key = headers['location'].strip().split('/')[-1]
        # If 300(Siblings), apply the siblings to the object
        elif status == 300:
            ctype, params = parse_header(headers['content-type'])
            if ctype == 'multipart/mixed':
                if six.PY3:
                    data = bytes_to_str(data)
                boundary = re.compile('\r?\n--%s(?:--)?\r?\n' %
                                      re.escape(params['boundary']))
                parts = [message_from_string(p)
                         for p in re.split(boundary, data)[1:-1]]
                robj.siblings = [self._parse_sibling(RiakContent(robj),
                                                     part.items(),
                                                     part.get_payload())
                                 for part in parts]

                # Invoke sibling-resolution logic
                if robj.resolver is not None:
                    robj.resolver(robj)

                return robj
            else:
                raise Exception('unexpected sibling response format: {0}'.
                                format(ctype))

        robj.siblings = [self._parse_sibling(RiakContent(robj),
                                             headers.items(),
                                             data)]

        return robj
1052780
function parseTextBody(req, res, next){
    if (req.body === undefined) {
      req.body = '';
      req.on('data', function(chunk){ req.body += chunk });
      req.on('end', next);
    } else {
      next();
    }
  }
923533
def get_fetch_response(self, raw):
        """"""
        p = Payload(raw)
        p._body = p.body
        return p
633876
def parse_response(response)
      unless response.body
        raise ResponseError, 'PaynetEasy response is empty'
      end

      # Change hash format from {'key' => ['value']} to {'key' => 'value'} in map block
      response_fields = Hash[CGI.parse(response.body).map {|key, value| [key, value.first]}]

      Response.new response_fields
    end
482888
public function loadResponseBody()
    {
        if (array_key_exists('php://output', $this->mockedData)) {
            $this->loadBodyByContent($this->getResponseHeader(), $this->mockedData['php://output']);
        }
        else {
            $this->loadBodyByContent($this->getResponseHeader(), file_get_contents("php://output"));
        }
    }
1149082
def _parse_content(response):
    """"""
    if response.status_code != 200:
        raise ApiError(f'unknown error: {response.content.decode()}')
    result = json.loads(response.content)
    if not result['ok']:
        raise ApiError(f'{result["error"]}: {result.get("detail")}')
    return result
1236489
def decode_body(body, content_type):
        """"""

        if isinstance(body, dict):
            return body
        else:
            try:
                decoded_body = base64.b64decode(body)
            except:
                return body

            if content_type == 'application/json':
                try:
                    return json.loads(decoded_body)
                except:
                    pass

            return decoded_body
1355789
def _process_req_body(self, body):
    
    try:
      return json.loads(body)
    except ValueError:
      return urlparse.parse_qs(body, keep_blank_values=True)
320899
def make_response(obj):
    """"""
    if obj is None:
        raise TypeError("Handler return value cannot be None.")
    if isinstance(obj, Response):
        return obj
    return Response(200, body=obj)
811802
def _parse_response(self, response):
        

        response_dict = {}
        for line in response.splitlines():
            key, value = response.split("=", 1)
            response_dict[key] = value
        return response_dict
812841
def response_from_mixed(mixed):
    """"""

    # if none then give empty Response
    if mixed is None:
        return Response()

    # if not Response, then treat like body
    if not isinstance(mixed, Response):
        return Response(mixed)

    # it's already a Response
    return mixed
432414
def new_from_response(cls, response):
        
        return cls(response.url, html=response.text, headers=response.headers)
954693
function processResponse(err, res, body) {

    if (err) { return cb(err); }

    if (res.statusCode !== 200) {
      return cb(new ScrapeError('Not OK response from server.', res, body));
    }

    parseBody(body, model, options, cb);

  }
1222471
def populate_resobj(rexobj, mobj, loc):
    '''
    
    '''
    resobj = REXResult(mobj, loc)
    rexobj.matches.append(resobj)
    rexobj.res_count += 1
465069
def parse(response):
        """"""
        if response.status_code == 400:
            try:
                msg = json.loads(response.content)['message']
            except (KeyError, ValueError):
                msg = ''
            raise ApiError(msg)
        return response
587487
def from_response(cls, response: 'ClientResponse') -> Any:
        
        obj = cls.response_wrapper_cls(response, cls(response.headers,
                                                     response.content))
        return obj
1133543
def build_response(body, status = 200, headers = {})
      @template = { body: body, status: status, headers: headers }
    end