Hi,
Maybe an kemi script would be an good choice here? So you can choose from
different script languages that kemi supports (Lua, python, js and many
more that I forgot)? You can also mix classic Kamailio scripting language
with kemi if that http request is the only business logic that need more
complex stuff.
Matteo Brancaleoni <mbrancaleoni(a)gmail.com> schrieb am Mi., 13. Sept. 2023,
10:31:
Ok,
seems that the Content-Type is added automatically by libcurl when
performing a POST request, unless it detects an already present hdr in the
headers params.
Seems that inverting the order of headers, so building the string with
"Content-Type: application/json\r\nAuthorization: Bearer sometoken" seems
to work, probably because libcurl detects the header and does not add it's
own.
But this is something "magic", not documented and prone to breakage, since
for libcurl headers should be a linked list of strings.
What do you suggest to properly handle that? Use scripting? Propose a
patch to split the headers string into a libcurl linked list?
br,
Mat
On Tue, Sep 12, 2023 at 5:53 PM Matteo Brancaleoni <mbrancaleoni(a)gmail.com>
wrote:
Hello all :)
I'm struggling to add two headers to an http client request, but cannot
find a proper way to do it.
The headers are Authorization and Content-Type.
The first try is with http_client module, beside undocumented, is
possible to add multiple headers separating them with "\r\n". What I see is
the correct Authorization header, and two Content-Type headers, one with my
content type the other with x-www-form-urlencoded, which no one sets ?
Second try is with http_async_client which supports multiple headers, but
since I'm calling it from an xhttp event route, there's no transaction and
request cannot be suspended, so I cannot get results before sending out
xhttp response...
Any hint?
br,
Mat
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-leave(a)lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to
the sender!
Edit mailing list options or unsubscribe: