Set response message
505099
def message(self, message=None):
        
        if message is not None:
            self.response_model.message = message
        return self.response_model.message
1229849
static function _httpResponseToMessage($response)
    {
        // Should this function be named Message.fromHTTPResponse instead?
        $response_message = Auth_OpenID_Message::fromKVForm($response->body);

        if ($response->status == 400) {
            return Auth_OpenID_ServerErrorContainer::fromMessage(
                        $response_message);
        } else if ($response->status != 200 and $response->status != 206) {
            return null;
        }

        return $response_message;
    }
935336
def send_success_response(self, msgid, methodname):
        """"""

        resp_xml = cim_xml.CIM(
            cim_xml.MESSAGE(
                cim_xml.SIMPLEEXPRSP(
                    cim_xml.EXPMETHODRESPONSE(
                        methodname),
                    ),  # noqa: E123
                msgid, IMPLEMENTED_PROTOCOL_VERSION),
            IMPLEMENTED_CIM_VERSION, IMPLEMENTED_DTD_VERSION)
        resp_body = '<?xml version="1.0" encoding="utf-8" ?>\n' + \
                    resp_xml.toxml()

        if isinstance(resp_body, six.text_type):
            resp_body = resp_body.encode("utf-8")

        http_code = 200
        self.send_response(http_code, http_client.responses.get(http_code, ''))
        self.send_header("Content-Type", "text/html")
        self.send_header("Content-Length", str(len(resp_body)))
        self.send_header("CIMExport", "MethodResponse")
        self.end_headers()
        self.wfile.write(resp_body)
108760
function(e,d){
      if(e){
        console.log("User set add data response: %s", d)
        e && console.error(e)
        return
      }
      console.log("User set add data response with no error: %s", d)  
    }
81236
function setMessageObject(ResponseInterface $httpMessage)
    {
        if (!$httpMessage instanceof ResponseInterface)
            throw new \InvalidArgumentException(sprintf(
                'This plugin need response object instance of iHttpResponse, "%s" given.'
                , get_class($httpMessage)
            ));

        $this->messageObject = $httpMessage;
        return $this;
    }
296248
def sendResponse(self, id, result, error):
        """"""
        self.sendMessage({"result":result, "error": error, "id":id})
392332
def setattr(self, req, ino, attr, to_set, fi):
        
        self.reply_err(req, errno.EROFS)
408738
public function setDefaultResponse()
    {
        $error = [[
            'status'    => $this->getStatusCode(),
            'code'      => $this->getCode(),
            'source'    => ['pointer' => $this->getDescription()],
            'title'     => strtolower(class_basename($this->exception)),
            'detail'    => $this->getMessage(),
        ]];

        $this->jsonApiResponse->setStatus($this->getStatusCode());
        $this->jsonApiResponse->setErrors($error);
    }
613917
private function setNewResponse(GetResponseForExceptionEvent $event, $statusCode, $message = '')
    {
        $event->setResponse(new Response());
        $event->getResponse()->setStatusCode($statusCode, $message);
    }
715190
def set_status(self, message, scope='status/write'):
        
        return _put(
            token=self.oauth.get_user_token(scope),
            uri='/user/statusmessage',
            data=message
        )
1201611
function handleResponse(ctx, response) {
  ctx.body = response.body;
  ctx.status = response.status;
  ctx.set(response.headers);
}
865870
def create_response(self, message, sign):
        
        def _response(code=200, data=None):
            """
            _response
            """
            resp_msg = message.to_response(code=code, data=data, sign=sign)

            with self._session.session_lock:
                mid = self._conn.publish(topic="/controller",
                                         qos=0, payload=resp_msg.to_dict())
                session = self._session.create(resp_msg, mid=mid, age=10)
            logging.debug("sending response as mid: %s" % mid)
            return self._wait_published(session, no_response=True)
        return _response
773066
function reply(req, res, opts) {
  opts = opts || {};

  return function(statusCode, body) {
    var call = { args: [].slice.call(arguments) };

    // handle single argument replies
    if (typeof statusCode === 'string') {
      body = { message: statusCode };
      statusCode = 200;
    } else if (statusCode instanceof Error) {
      body = statusCode;
      statusCode = 500;
    }

    // handle error objects in replies
    if (body instanceof Error) {
      if (typeof body.statusCode === 'number') {
        statusCode = body.statusCode;
      }
      if (body.expose) {
        body = body.toJSON ? body.toJSON() : { message: body.message };
      } else {
        body = undefined;
      }
    }

    // default message
    if (body === undefined) {
      body = { message: http.STATUS_CODES[statusCode] || 'unknown response' };
    }

    call.statusCode = statusCode;
    call.body = body;

    // allow user to override body before sending
    if (req.sf.responseMessage) {
      call = req.sf.responseMessage(call);

      if (!call) {
        debug('responseMessage handled reply');
        return;
      }

      statusCode = call.statusCode;
      body = call.body;
    }

    var length = 0;
    var type;

    if (body !== undefined) {
      if (Buffer.isBuffer(body)) {
        length = body.length;
      } else if (res.sf && res.sf.produce) {
        type = res.sf.produce.mime;
        body = res.sf.produce.encoder(body);
        length = Buffer.byteLength(body, CHARSET);
      } else {
        type = 'application/json';
        body = encoder[type](body);
        length = Buffer.byteLength(body, CHARSET);
      }
    }

    var noContent = statusCode === 204 || statusCode === 304;

    if (!noContent && !res.headersSent) {
      if (type && !res.getHeader('content-type') ||
        res.getHeader('content-type') !== type) {
        res.setHeader('content-type', type + '; charset=' + CHARSET);
      }

      if (!res.getHeader('content-length') ||
        res.getHeader('content-length') !== length) {
        res.setHeader('content-length', length);
      }

      // add etag header if not already set
      if (opts.etag && body && body.length && !res.getHeader('etag') &&
          req.method === 'GET' && Math.floor(statusCode / 100) === 2) {
        var etag = crypto.createHash('md5').update(body).digest('hex');
        res.setHeader('etag', etag);
      }

      // if cache is fresh set status code to 304
      if (fresh(req.headers, res._headers)) {
        statusCode = 304;
        noContent = true;
      }

      if (noContent) {
        res.removeHeader('content-type');
        res.removeHeader('content-length');
        res.removeHeader('transfer-encoding');
      }
    }

    if (noContent) body = '';

    res.statusCode = statusCode;

    return res.end(req.method === 'HEAD' ? null : body);
  };
}
272670
function defaultResponse(response) {
  var level =
    response.status < 300
      ? "info"
      : response.status < 500
        ? "warning"
        : "error";
  this.$emit("formMessage", {
    level: level,
    data: response.data,
    response: response
  });
}
847502
protected function setMessage()
    {
        $this->message = sprintf($this->message, $this->argumentName, $this->expected, $this->actual);
    }
1139441
private void setResponseElements(IntuitMessage intuitMessage, HttpResponse httpResponse) throws FMSException {
        ResponseElements responseElements = intuitMessage.getResponseElements();
        if(httpResponse.getLastHeader(RequestElements.HEADER_PARAM_CONTENT_ENCODING) != null)
        {
        responseElements.setEncodingHeader(httpResponse.getLastHeader(RequestElements.HEADER_PARAM_CONTENT_ENCODING).getValue());
        }
        else
        {
            responseElements.setEncodingHeader(null);
        }
        if(httpResponse.getLastHeader(RequestElements.HEADER_PARAM_CONTENT_TYPE) !=null)
        {
        responseElements.setContentTypeHeader(httpResponse.getLastHeader(RequestElements.HEADER_PARAM_CONTENT_TYPE).getValue());
        }
        else
        {
            responseElements.setContentTypeHeader(null);
        }
        responseElements.setStatusLine(httpResponse.getStatusLine());
        responseElements.setStatusCode(httpResponse.getStatusLine().getStatusCode());
        try {
            responseElements.setResponseContent(getCopyOfResponseContent(httpResponse.getEntity().getContent()));
        } catch (IllegalStateException e) {
            LOG.error("IllegalStateException while get the content from HttpRespose.", e);
            throw new FMSException(e);
        } catch (Exception e) {
            LOG.error("IOException in HTTPClientConnectionInterceptor while reading the entity from HttpResponse.", e);
            throw new FMSException(e);
        }
    }
1322816
def setFindFailedResponse(self, response):
        
        valid_responses = ("ABORT", "SKIP", "PROMPT", "RETRY")
        if response not in valid_responses:
            raise ValueError("Invalid response - expected one of ({})".format(", ".join(valid_responses)))
        self._findFailedResponse = response