Set response data
771409
def data(self, data=None):
        
        if data is not None:
            self.response_model.data = data
        return self.response_model.data
506592
function prepareData(response, rootUrl, data) {
  if(data.devices) {
    var devices = data.devices;
    for(var device in devices) {
      devices[device].href = rootUrl + '/whereis/transmitter/' + device;
      var radioDecodings = devices[device].radioDecodings;
      for(var cDecoding = 0; cDecoding < radioDecodings.length; cDecoding++) {
        var radioDecoder = radioDecodings[cDecoding].identifier.value;
        radioDecodings[cDecoding].href = rootUrl + '/whatat/receiver/' +
                                         radioDecoder;
      }
    }
    response.devices = devices;
  }
}
727031
def __respond_with_dict(self, data):
        
        response = {}
        if isinstance(data, list):
            temp_data, data = data, {}
            for key, value in enumerate(temp_data):
                data[key] = value

        data.pop('seq', None)
        for index, item in data.items():
            values = item
            if isinstance(item, list) or isinstance(item, dict):
                values = self.__respond_with_dict(item)

            if isinstance(values, dict) and len(values) == 1:
                (key, values), = values.items()
            response[index] = values

        return response
83193
def set_response(item_class_name)
      if @api_response.success?
        @total_count = @api_response["totalCount"]
        @total_pages = @api_response["totalPages"]
        @count = @api_response["count"]
        @timestamp = @api_response["timestamp"]
        @items = []
        unless @api_response["collection"].nil?
          @api_response["collection"].each do |attr_item|
            item = item_class_name.new
            item.set_item(attr_item)
            @items << item
          end
        end
      else
        @error = @api_response.parsed_response
      end
    end
773213
def _set_attrs_to_values(self, response={}):
        
        for key in response.keys():
            setattr(self, key, response[key])
746843
public RequestResponse setRequestData(Object requestData) {
        this.requestData = requestData;
        requestJson = requestData != null
                ? (requestData instanceof JsonNode ? (JsonNode) requestData
                        : SerializationUtils.toJson(requestData))
                : null;
        return this;
    }
212658
def _set_parse_data(self):
        
        pdata = self._load_response('parse')['parse']

        self.data['iwlinks'] = utils.get_links(pdata.get('iwlinks'))
        self.data['pageid'] = pdata.get('pageid')
        self.data['wikitext'] = pdata.get('wikitext')

        parsetree = pdata.get('parsetree')
        self.data['parsetree'] = parsetree

        boxterm = self.params.get('boxterm')
        if boxterm:
            infobox = utils.get_infobox(parsetree, boxterm)
        else:
            infobox = utils.get_infobox(parsetree)
        self.data['infobox'] = infobox

        title = pdata.get('title')
        if title:
            self.data['title'] = title
            if not self.params.get('title'):
                self.params['title'] = title

        wikibase = pdata.get('properties').get('wikibase_item')
        if wikibase:
            self.data['wikibase'] = wikibase
            self.data['wikidata_url'] = utils.wikidata_url(wikibase)

        if self.data['infobox']:
            self._set_parse_image(self.data['infobox'])
1219232
function onResponse( response ) {
		res = response;
		if ( res.statusCode !== 200 ) {
			err = {
				'status': res.statusCode,
				'message': ''
			};
		}
		debug( 'Received a response from query endpoint.' );
		debug( 'Response status: %s.', res.statusCode );

		debug( 'Response headers: %s', JSON.stringify( res.headers ) );

		res.setEncoding( 'utf8' );
		res.on( 'data', onData );
		res.on( 'end', onEnd );
	}
466545
def set_response_cookie(response, cookie_name, cookie_value):
    
    now = timezone.now()
    expire_date = now + datetime.timedelta(days=365)
    response.set_cookie(cookie_name, cookie_value, expires=expire_date)
1005474
def set_response(values, app)
      values = Array.wrap(values)
      if !object_name.blank? and !attribute_name.blank?
        # if eval("app." + object_name).present?
        object = object_name == 'application' ? app : eval("app." + object_name)
        unless object.present?
          if object_name.include?('.')
            objects = object_name.split('.')
            object = eval("app." + objects[0..-2].join('.') + ".create_" + objects.last)
            eval("app." + objects[0..-2].join('.')).reload
          end
        end
        unless responses(app) == values
          value = ActiveRecord::Base.connection.quote_string(values.first)
          if self.is_a?(DateField) && value.present?
            begin
              value = Date.strptime(value, (I18n.t 'date.formats.default'))
            rescue
              raise "invalid date - " + value.inspect
            end
          end
          object.update_attribute(attribute_name, value) 
        end
        # else
        #   raise object_name.inspect + ' == ' + attribute_name.inspect
        # end
      else
        @answers ||= []
        @mark_for_destroy ||= []
        # go through existing answers (in reverse order, as we delete)
        (@answers.length - 1).downto(0) do |index|
          # reject: skip over responses that are unchanged
          unless values.reject! {|value| value == @answers[index]}
            # remove any answers that don't match the posted values
            @mark_for_destroy << @answers[index]   # destroy from database later 
            @answers.delete_at(index)
          end
        end
      
        # insert any new answers
        for value in values
          if @mark_for_destroy.empty?
            answer = Answer.new(:question_id => self.id)
          else
            # re-use marked answers (an update vs. a delete+insert)
            answer = @mark_for_destroy.pop
          end
          answer.set(value)
          @answers << answer
        end
      end
    end
1231153
def _set_data(self, data):
        """"""
        if type(data) == bytearray:
            self._data = data
        elif type(data) == str:
            if sys.version_info < (3,):
                self._data = bytearray(data)
            else:
                self._data = bytearray(data.encode('ISO-8859-1'))
        elif type(data) == list or type(data) == tuple:
            self._data = bytearray(data)
        elif sys.version_info >= (3,) and type(data) == bytes:
            self._data = bytearray(data)
        else:
            raise Exception('Data must be bytearray, string, list or tuple,'
                            ' not {}'.format(type(data)))
196324
void setResponse(HttpResponse response) {
        if (isResponseAborted) {
            // This means that we already tried to close the request, so abort the response immediately.
            if (!response.isComplete()) {
                response.abort();
            }
        } else {
            this.response = response;
        }
    }
105947
private void setResponse(int statusCode, String statusMessage, String responseBody, Map<String, List<String>> responseHeaders)
    {
        mStatusCode      = statusCode;
        mStatusMessage   = statusMessage;
        mResponseBody    = responseBody;
        mResponseHeaders = responseHeaders;
    }
784222
def set_data(self, data=None, **kwargs):
        '''
        
        '''
        if data is None:
            data = self.get_data(**kwargs)
        setattr(self, '_data', data)
        self.history += self.queue
        self.queue = []
501043
protected function setData($data = [])
    {
        if (!isset($data[self::RS_KEY_CODE])) {
            $data[self::RS_KEY_CODE] = 0;
        }
        if (!isset($data[self::RS_KEY_MSG])) {
            $data[self::RS_KEY_MSG] = 'Success';
        }
        if (!isset($data[self::RS_KEY_TYPE])) {
            $data[self::RS_KEY_TYPE] = self::RESPONSE_XHTML;
        }

        if (!isset($data[self::RS_KEY_DATA])) {
            $data[self::RS_KEY_DATA] = new \stdClass();
        } else {
            if (!$data instanceof \stdClass) {
                $data[self::RS_KEY_DATA] = new \stdClass();
            }
        }
        $this->data = $data;
    }
710838
function Response(statusCode, headers, body) {
  this.statusCode = statusCode;
  this.headers = {};
  for (var key in headers) {
    this.headers[key.toLowerCase()] = headers[key];
  }
  this.body = body;
}
829019
def _format_response(self, request, response):
        

        res = datamapper.format(request, response, self)
        # data is now formatted, let's check if the status_code is set
        if res.status_code is 0:
            res.status_code = 200
        # apply headers
        self._add_resposne_headers(res, response)
        return res