Hello,

apparently that feature was not migrated in http_client, being overlooked when the variant from utils modules was removed.

I just pushed a patch for it in master branch. If you can test it and report if all works fine, then I will consider backporting it to 5.0, given it is like a regression.

Otherwise, I haven't seen an option to provide custom headers to functions in http_client module, but http_async_client has this option, and I expect (not checked the code) that together with disabling suspend option should be like a synchronous query.

Cheers,
Daniel


On 29.06.17 20:47, Joel Serrano wrote:
Hi all, 

Is there a way to add extra headers with http_client_query() from http_client module?

In current http_query() from utils module, according to the doc, you can add a custom header:

4. Functions
4.1.  http_query(url, [post-data], [header-data], result)
...
If you want to add additional headers to the request, you have to define the “header”-data, that should be submitted in that request as the third parameter. If this parameter is empty, it is not set.
...

and I have that working with the following:

http_query("https://example.com/api", "param1=value1&param2=value2", "Cookie: apikey=super_secret_api_key", "$var(call_info)");


The problem is that http_query() is removed in Kamailio v5, and the http_client_query() only has the ability to add specifically the content-type header:

4. Functions
4.1.  http_connect(connection, url, [content_type, data,] result)
...
content_type - Used only when posting data with HTTP POST. An Internet Media type, like "application/json" or "text/plain". Will be added to the HTTP request as a header.
...


Is there another way to add a custom header to a http request with the http_client module?

Any workarounds for this?


Thanks, 
Joel.




_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - www.asipto.com
Kamailio World Conference - www.kamailioworld.com