[Freeswitch-users] mod_curl setting content type header

Michael Collins msc at freeswitch.org
Thu Sep 4 03:15:20 MSD 2014


Hi Philip,

It looks like the wiki is not quite up to date with the source code, but
given how fast anthm writes code I'm not surprised. :)

The syntax suggests you can do it. From mod_curl.c:
static char *SYNTAX = "curl url [headers|json|content-type <mime-type>]
[get|head|post [post_data]]";

So maybe something like:
curl http://foo.bar content-type 'application/JSON'

Just throwing ideas out there. Please tinker and report back. :)

-MC


On Wed, Sep 3, 2014 at 10:54 AM, Phillip Jones <pjintheusa at gmail.com> wrote:

> Hi there,
>
> Anyone out there with some experience shed some light on this?
>
> Looking to set the Content-Type in mod_curl header so that the server
> with recognize that the format of that data being send. For example
> 'application/JSON'
>
>
> On Thu, May 29, 2014 at 12:36 AM, Jeff Stark <jstark888 at gmail.com> wrote:
>
>> Hi,
>>
>> More info on the problem:
>>
>> [DEBUG] mod_curl.c:166 method: post, url: http://<private
>> IP>:8080/PushServer/api/push, content-type: (null)
>>
>> So for some reason mod_curl is not setting the Content-Type header at
>> all, which is what I think is causing my web server to complain.
>>
>> Thanks.
>>
>> Jeff
>>
>>
>> On Wed, May 28, 2014 at 4:49 PM, Jeff Stark <jstark888 at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> Is there a way to set the Content-Type header when using mod_curl in a
>>> Lua script?
>>>
>>> Using curl on the command line I can do the following:
>>>
>>>  curl -H "Content-Type: application/json" -H "Accept: application/json"
>>> -X POST -d '{"field1":"val1","field2":"val2"}' http://mydomain.com/
>>>
>>> And in a Lua script I can do the following:
>>>
>>> local my_json = "{\"field1\":\"val1\",\"field2\":\"val2\"}"
>>> api = freeswitch.API()
>>> response_data = api:execute("curl", "http://mydomain.com/ post" ..
>>>  my_json)
>>>
>>> But I don't see a way in the freeswitch API to set the Content-Type
>>> header in the above script.
>>>
>>> Appreciate any help or insight that can be offered.
>>>
>>> Thanks.
>>>
>>> Jeff
>>>
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> 
> 
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140903/b12b41bd/attachment.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list