I tried to implement an async task each time a node is inserted by sending by POST the json_encoded node object to my processing url.

I might be completely stupid but it seems that the httprl module is not sending any data by POST unfortunately :(
======================
EDIT = I AM STUPID => RTFM
======================

 * @param array $options
 *   (optional) An array that can have one or more of the following elements:
 *   - headers: An array containing request headers to send as name/value pairs.
 *     Some of the more useful headers:
 *     - For POST: 'Content-Type' => 'application/x-www-form-urlencoded',
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

guenoz’s picture

Status: Active » Closed (fixed)

You have to implement the right Content-type header :

$options = array(
		'method' => 'POST',
		'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
		'data' => 'yourdata=goeshere',
	);
mikeytown2’s picture

Category: bug » feature
Status: Closed (fixed) » Active

This brings up an interesting thing though... if the method is set to POST and data is not empty and Content-Type is not set, should I auto set the Content-Type to application/x-www-form-urlencoded? The use cases where this is not what one wants is slim.

guenoz’s picture

Status: Active » Needs review
FileSize
558 bytes

It could have saved me from loosing precious time so I would say it is definitely a good line to add to the code ;)
Patch attached

mikeytown2’s picture

I was thinking of something more along the line of this patch.

mikeytown2’s picture

Status: Needs review » Fixed

This patch has been committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

fix found in comments