Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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',
Comment | File | Size | Author |
---|---|---|---|
#4 | httprl-149117-4-set-content-type-on-post.patch | 842 bytes | mikeytown2 |
#3 | POST_Content_Type-1491170-3.patch | 558 bytes | guenoz |
Comments
Comment #1
guenoz CreditAttribution: guenoz commentedYou have to implement the right Content-type header :
Comment #2
mikeytown2 CreditAttribution: mikeytown2 commentedThis 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.Comment #3
guenoz CreditAttribution: guenoz commentedIt 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
Comment #4
mikeytown2 CreditAttribution: mikeytown2 commentedI was thinking of something more along the line of this patch.
Comment #5
mikeytown2 CreditAttribution: mikeytown2 commentedThis patch has been committed.
Comment #6.0
(not verified) CreditAttribution: commentedfix found in comments