Builds the response to return to the caller.
350388
def _BuildAuthenticatorResponse(self, app_id, client_data, plugin_response):
    """"""
    encoded_client_data = self._Base64Encode(client_data)
    signature_data = str(plugin_response['signatureData'])
    key_handle = str(plugin_response['keyHandle'])

    response = {
        'clientData': encoded_client_data,
        'signatureData': signature_data,
        'applicationId': app_id,
        'keyHandle': key_handle,
    }
    return response
773444
def build_response_object(session_end = true)
      @response = Hash.new
      @response[:outputSpeech] = @speech unless @speech.nil?
      @response[:directives] = @directives unless @directives.empty?
      @response[:card] = @card unless @card.nil?
      @response[:reprompt] = @reprompt unless session_end && @reprompt.nil?
      @response[:shouldEndSession] = session_end
      @response
    end
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
474826
def process_response(self, request, response, resource, req_succeeded):
        """"""
        sid = request.cookies.get(self.cookie_name, None)
        if sid is None or not self.store.exists(sid):
            sid = self.generate_sid()

        self.store.set(sid, request.context.get(self.context_name, {}))
        response.set_cookie(self.cookie_name, sid, expires=self.cookie_expires, max_age=self.cookie_max_age,
                            domain=self.cookie_domain, path=self.cookie_path, secure=self.cookie_secure,
                            http_only=self.cookie_http_only)
586821
private function buildResponse() {

        $curlOptions = $this->getBasicCurlOptions();
        $this->addRequestAuth($curlOptions);
        $this->addRequestHeaders($curlOptions);
        $this->addRequestMethod($curlOptions);

        // push options into the resource
        $curlResource = $this->getCurlResource();
        if (!curl_setopt_array($curlResource, $curlOptions)) {
            throw new RequestException('Invalid cURL options');
        }

        // create response
        $response = new Response($curlResource);
        return $response;
    }
315665
def _call(self, method, url, params):
        """"""
        request_params = {}
        if method == 'GET':
            request_params['params'] = params
        elif method == 'POST':
            request_params['data'] = params
        response = requests.request(method, url, **request_params)
        return response
935705
public void returnClient(CloseableHttpResponse resp) {
        try { 
            if (resp != null) {
                EntityUtils.consume(resp.getEntity());
            }
        } catch (IOException ex) {
            //TODO: Could not consume response completely. This is serious because the client will not be returned back to pool.
            log.error("Error returning client to pool {}", ExceptionUtils.getStackTrace(ex));
        }
    }
912295
def _handle_response(self, response):
        
        if response.status_code == requests.codes.ok or response.status_code == requests.codes.created:
            try:
                return response.json()
            except ValueError:
                return response
        else:
            return self._handle_failed_response(response)
396814
private Function<? super Method, Reply> returnReply(Object obj) {
    return method -> {
      try {
        return (Reply) method.invoke(obj);
      } catch (IllegalAccessException | InvocationTargetException e) {
        BotLogger.error("Could not add reply", TAG, e);
        throw propagate(e);
      }
    };
  }
612470
protected function _buildAndExecuteProxyResponse()
    {
        if($this->_responseModifier)
        {
          $data = call_user_func_array($this->_responseModifier, array(&$this->_responseBody, &$this->_responseHeaders));
        }

        $this->_generateProxyResponseHeaders();

        $this->_output($this->_responseBody);
    }
1089269
function response()
    {
        if (!$this->response) {
            $settings = new DataParseResponsePhp;
            $response = new HttpResponse(
                new BuildHttpResponse( BuildHttpResponse::parseWith($settings) )
            );

            $this->response = $response;
        }

        return $this->response;
    }
417132
def build(self):
        """"""
        if self.is_built():  # pragma: no cover
            return
        with _wait_signal(self.loadFinished, 20):
            self.rebuild()
        self._built = True
60065
def execute(self, request_object):
        """"""

        # If the request object is not valid then return a failure response
        if not request_object.is_valid:
            return ResponseFailure.build_from_invalid_request(
                request_object)

        # Try to process the request and handle any errors encountered
        try:
            return self.process_request(request_object)

        except ValidationError as err:
            return ResponseFailure.build_unprocessable_error(err.normalized_messages)

        except ObjectNotFoundError:
            return ResponseFailure.build_not_found(
                [{'identifier': 'Object with this ID does not exist.'}])

        except Exception as exc:
            logger.error(
                f'{self.__class__.__name__} execution failed due to error {exc}',
                exc_info=True)
            return ResponseFailure.build_system_error([{exc.__class__.__name__: exc}])
916689
protected String build(Response response) {
    StringBuilder sb = new StringBuilder();
    sb.append("<div class='container'>");
    sb.append("<div class='row-fluid'>");
    sb.append("<div class='span12'>");
    sb.append(buildJSONResponseBox(response));
    if( response._status == Response.Status.done ) response.toJava(sb);
    sb.append(buildResponseHeader(response));
    Builder builder = response.getBuilderFor(ROOT_OBJECT);
    if (builder == null) {
      sb.append("<h3>"+name()+"</h3>");
      builder = OBJECT_BUILDER;
    }
    for( String h : response.getHeaders() ) sb.append(h);
    if( response._response==null ) {
      boolean done = response._req.toHTML(sb);
      if(!done) {
        JsonParser parser = new JsonParser();
        String json = new String(response._req.writeJSON(new AutoBuffer()).buf());
        JsonObject o = (JsonObject) parser.parse(json);
        sb.append(builder.build(response, o, ""));
      }
    } else sb.append(builder.build(response,response._response,""));
    sb.append("</div></div></div>");
    return sb.toString();
  }
1133543
def build_response(body, status = 200, headers = {})
      @template = { body: body, status: status, headers: headers }
    end
71635
function () {

    const oThis = this;

    const callback = async function (response) {
      if (response.isFailure()) {
        return response;
      }
      return responseHelper.successWithData({allTimeStakedAmount: response.data.getTotalStake});
    };

    return oThis._callMethod('getTotalStake').then(callback);

  }
976494
@Override
    public void handle(T result, HttpResponse response) {
        String restoreHeader = response.getHeaders().get(Headers.RESTORE);
        if (restoreHeader != null) {
            result.setRestoreExpirationTime(parseDate(restoreHeader));
            Boolean onGoingRestore = parseBoolean(restoreHeader);
            if (onGoingRestore != null) {
                result.setOngoingRestore(onGoingRestore);
            }
        }
    }