Finish filling the instance's response object so it's ready to be
        served to the client. This includes converting the body_raw property
        to the content type requested by the user if necessary.
505456
def convert_response(self):
        
        if hasattr(self.response, 'body_raw'):
            if self.response.body_raw is not None:
                to_type = re.sub('[^a-zA-Z_]', '_', self.type)
                to_type_method = 'to_' + to_type
                if hasattr(self, to_type_method):
                    self.response.body = getattr(self, to_type_method)(
                        self.response.body_raw)
            del self.response.body_raw
232297
def finish(self):
        
        headers, body = self._prepare_batch_request()

        url = "%s/batch/storage/v1" % self.API_BASE_URL

        # Use the private ``_base_connection`` rather than the property
        # ``_connection``, since the property may be this
        # current batch.
        response = self._client._base_connection._make_request(
            "POST", url, data=body, headers=headers
        )
        responses = list(_unpack_batch_response(response))
        self._finish_futures(responses)
        return responses
164747
def complete(self):
        
        return self._post_request(
            data='',
            endpoint=self.ENDPOINT + '/' + str(self.id) + '/complete'
        )
466980
def respond(response)
      no_body = @status < 200 || STATUS_WITH_NO_ENTITY_BODY[@status]
      write_status(response)
      write_headers(response)
      if @hijack
        @hijack.call(response.net_socket)
        return
      end
      if no_body
        response.end
      else
        if @body.respond_to?(:to_path)
          response.send_file(@body.to_path)
        else
          write_body(response)
          response.end
        end
      end
    rescue NativeException => e
      puts e
    ensure
      @body.close if @body.respond_to?(:close)
    end
1022456
def send_response(self, body, set_content_type=True):
        
        settings = get_settings(self.application, force_instance=True)
        handler = settings[self.get_response_content_type()]
        content_type, data_bytes = handler.to_bytes(body)
        if set_content_type:
            self.set_header('Content-Type', content_type)
            self.add_header('Vary', 'Accept')
        self.write(data_bytes)
880363
function onResponse(type, pRes) {
    contentTypes[type] = pRes.headers['content-type'].split(';')[0];
    responses[type]    = pRes;

    //
    // If we have both a public and a private
    // response.
    //
    if (responses.public && responses.private) {
      if (contentTypes.public === contentTypes.private) {
        return self.merge.handlers[contentTypes.public](req, res, responses);
      }

      res.writeHead(500, { 'content-type': 'text/plain' });
      res.end('Content-Type mismatch: ' + JSON.stringify(contentTypes));
    }
  }
309900
def on_complete(env)
      if env[:body].error?
        @logger.warn env[:raw_body] if VkontakteApi.log_errors?
      else
        @logger.debug env[:raw_body] if VkontakteApi.log_responses?
      end
    end
964202
def format_response(status, body_object, headers={})
      if status == 204
        body = ''
      else
        body = case response_media_type
        when 'application/json'
          JSON.pretty_generate(body_object)
        when 'application/x-www-form-urlencoded'
          URI.encode_www_form(body_object)
        when 'application/xml'
          body_object.to_s
        when 'text/plain'
          body_object
        else
          # :nocov:
          raise NotImplementedError, "unsupported response media type #{response_media_type}"
          # :nocov:
        end
      end
      [status, headers.merge({'Content-Type' => response_media_type}), [body]]
    end
1355789
def _process_req_body(self, body):
    
    try:
      return json.loads(body)
    except ValueError:
      return urlparse.parse_qs(body, keep_blank_values=True)
729216
def sendFinalResponse(self):
        
        self.requestProtocol.requestResponse["code"] = (
            self.responseCode
        )
        self.requestProtocol.requestResponse["content"] = (
            self.responseContent
        )
        self.requestProtocol.requestResponse["errors"] = (
            self.responseErrors
        )
        self.requestProtocol.sendFinalRequestResponse()
982292
protected function requestFinished()
    {
        $this->onResponse->executeOne($this, true);
        $this->state = self::STATE_ROOT;
        $this->contentLength = -1;
        $this->curChunkSize = null;
        $this->chunked = false;
        $this->eofTerminated = false;
        $this->headers = [];
        $this->rawHeaders = null;
        $this->contentType = null;
        $this->charset = null;
        $this->body = '';
        $this->responseCode = 0;
        $this->reqType = null;
        if (!$this->keepalive) {
            $this->finish();
        }
        $this->checkFree();
    }
678232
def after_request(self, response):
        
        if response is not None and request is not None:
            # When used as response processor, only run if we are requesting
            # anything but a static resource.
            if request.endpoint in [None, "static"]:
                return response
        self.compile()
        return response
309159
def on_finish(self):
        
        r = self.response
        r.request_time = time.time() - self.start_time
        if self.callback:
            self.callback(r)
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"));
        }
    }
454656
def on_finish(self):
        
        super(SessionRequestHandler, self).on_finish()
        LOGGER.debug('Entering SessionRequestHandler.on_finish: %s',
                     self.session.id)
        self.session.last_request_at = self.current_epoch()
        self.session.last_request_uri = self.request.uri
        if self.session.dirty:
            result = yield self.session.save()
            LOGGER.debug('on_finish yield save: %r', result)
        self.session = None
        LOGGER.debug('Exiting SessionRequestHandler.on_finish: %r',
                     self.session)
430904
def after_request(response)
      @response = HTTParty::Response.new(self, response, -> { HTTParty::Parser.new(response.body, Jiralicious::Session.format).parse }, body: response.body)
    end
395232
private function finalizeOutputBuffer()
    {
        // Clean out the output buffer to the response, and send the built-up response to the client
        if ($this->isBuffering) {
            $this->response->appendBody(ob_get_contents());
            $this->isBuffering = false;

            ob_end_clean();
        }
    }