Add payload to request. By default, payload is sent as application/json
555305
protected int addPayload(RestRequestBuilder builder, String payload) {
    if (payload == null || payload.length() == 0) {
      return 0;
    }

    builder.setHeader(RestConstants.HEADER_CONTENT_TYPE, RestConstants.HEADER_VALUE_APPLICATION_JSON);
    try {
      DataMap data = JACKSON_DATA_CODEC.stringToMap(payload);
      byte[] bytes = JACKSON_DATA_CODEC.mapToBytes(data);
      builder.setEntity(bytes);
      return bytes.length;
    } catch (IOException e) {
      throw new RuntimeException("Fail to convert payload: " + payload, e);
    }
  }
1361930
def append_info_to_payload(payload)
      super
      payload[:session_id] = request.session_options[:id]
      payload[:uuid] = request.uuid
      payload[:host] = request.host
    end
1139138
def deliver_hook(target, payload, instance_id=None, hook_id=None, **kwargs):
    
    r = requests.post(
        url=target,
        data=json.dumps(payload),
        headers={
            "Content-Type": "application/json",
            "Authorization": "Token %s" % settings.HOOK_AUTH_TOKEN,
        },
    )
    r.raise_for_status()
    return r.text
387303
def deliver_hook(self, instance, payload_override=None):
        
        payload = payload_override or self.serialize_hook(instance)
        if getattr(settings, 'HOOK_DELIVERER', None):
            deliverer = get_module(settings.HOOK_DELIVERER)
            deliverer(self.target, payload, instance=instance, hook=self)
        else:
            client.post(
                url=self.target,
                data=json.dumps(payload, cls=DjangoJSONEncoder),
                headers={'Content-Type': 'application/json'}
            )

        signals.hook_sent_event.send_robust(sender=self.__class__, payload=payload, instance=instance, hook=self)
        return None
886553
def put(url, payload)
      data = payload.to_json
      response = Curl::Easy.http_put(url, data) do |curl| 
        curl.headers["Content-Type"] = "application/json"
        curl.on_failure do |response, err|
          RHapi::ConnectionError.raise_error("#{response.response_code}\n Error is: #{err.inspect}")
        end
      end
      RHapi::ConnectionError.raise_error(response.header_str) unless response.header_str =~ /2\d\d/
    end
459047
function capturePayload (endpoint, payload) {
  var dumpfile = path.join(os.tmpdir(), 'opbeat-' + endpoint + '-' + Date.now() + '.json')
  fs.writeFile(dumpfile, JSON.stringify(payload), function (err) {
    if (err) console.log('could not capture intake payload: %s', err.message)
    else console.log('intake payload captured: %s', dumpfile)
  })
}
583352
def post(self, resource, data=None, **kwargs):
        """"""
        headers = dict(kwargs.pop('headers', {}))
        headers.setdefault('Content-Type', 'application/json')
        data = json.dumps(data)
        return self.request('POST', resource, headers=headers,
                            data=data, **kwargs)
572942
def post(path, payload, additional_options = {})
      raise PayloadError.new, Nokogiri::XML(payload).errors if Nokogiri::XML(payload).errors.any?
      request 'POST', path, { body: payload }.merge(additional_options)
    end
1194459
def make_payload(base, method, params):
    
    payload = {
        'jsonrpc': '2.0',
        'method': '{base}APING/v1.0/{method}'.format(**locals()),
        'params': utils.serialize_dict(params),
        'id': 1,
    }
    return payload
442222
def update(self, query, payload):
        

        if not isinstance(payload, dict):
            raise InvalidUsage("Update payload must be of type dict")

        record = self.get(query).one()

        self._url = self._url_builder.get_appended_custom("/{0}".format(record['sys_id']))
        return self._get_response('PUT', data=json.dumps(payload))
1297105
public void sendPayload(String payload) {
		MessageEnvelope envelope = new MessageEnvelope();
		Postback postback = new Postback();

		postback.setPayload(payload);
		envelope.setPostback(postback);
		envelope.setSender(new User(facebookMockId));

		System.out.println("Sending payload: [" + payload + "] as user : ["
				+ facebookMockId + "].");
		forward(envelope);
		System.out.println("Sent!");
	}
1081796
def post(self, path, payload):
        """"""
        body = json.dumps(payload)
        return self._request(path, 'POST', body)
603285
def _send_request(self, operation, url, payload, desc):
        """"""

        res = None
        try:
            payload_json = None
            if payload and payload != '':
                payload_json = jsonutils.dumps(payload)
            self._login()
            desc_lookup = {'POST': ' creation', 'PUT': ' update',
                           'DELETE': ' deletion', 'GET': ' get'}

            res = requests.request(operation, url, data=payload_json,
                                   headers=self._req_headers,
                                   timeout=self.timeout_resp, verify=False)
            desc += desc_lookup.get(operation, operation.lower())
            LOG.info("DCNM-send_request: %(desc)s %(url)s %(pld)s",
                     {'desc': desc, 'url': url, 'pld': payload})

            self._logout()
        except (requests.HTTPError, requests.Timeout,
                requests.ConnectionError) as exc:
            LOG.exception('Error during request: %s', exc)
            raise dexc.DfaClientRequestFailed(reason=exc)

        return res
862761
def _generate_request(self, callname, request):
        """"""
        # Retrieve path from API class
        schema = self.api.request_schema()
        schema.context['callname'] = callname
        return schema.dump(request).data.get("payload")
1341210
def put(path, options={}, raw=false, unformatted=true)
      request(:put, path, options, raw, unformatted)
    end
59934
def _post_json(self, url, data, **kw):
        '''
        
        '''
        data = json.dumps(data)
        headers = kw.pop('headers', {})
        headers.setdefault('Content-Type', 'application/json')
        headers.setdefault('Accept', 'application/json')

        kw['headers'] = headers
        kw['data'] = data
        return self._post(url, **kw)
19201
def _http_put(self, url, data, **kwargs):
        

        kwargs.update({'data': json.dumps(data)})

        return self._http_request('put', url, kwargs)