Home/Support/Support Forum/HTTP Client - How to send a GET with a customized Header
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

HTTP Client - How to send a GET with a customized Header

0 votes
I need to send a request using the http client lib, I have to send a parameter that is an ID number in the Header of the HTTP message. I'm using the library http_client , DC 10.72 , RCM6760.

I have not found any client-side function in http client that mounts the header to send a GET request .
asked Mar 10, 2016 in Rabbit Software by sshamali New to the Community (0 points)
One more thing, I tried to use HTTP_CUSTOM_HEADERS but I guess it works only if i'm in the server side. This is a basic thing there must be a way to modify the header so I can send information there in the GET request....

Please log in or register to answer this question.

2 Answers

0 votes
Looking at the http_client.lib library you would need to modify the httpc_request() function to do this as it constructs the request based on the passed in parameters. You could modify it to add an additional parameter for the custom data and have it insert it at the position you desire.

You could do it with a wrapper function to allow any existing code call the httpc_request() function as normal - it then calls for example httpc_request_new() with null for the new parameter to indicate don't insert custom data and your code calls httpc_request_new() directly.

Regards,
Peter
answered Mar 21, 2016 by petermcs Veteran of the Digi Community (1,128 points)
0 votes
I added that functionality last December, and it will be included in the upcoming Dynamic C 10.72A release. You might be able to pull the updated http_client.lib from GitHub -- the change appears in this commit:

https://github.com/digidotcom/DCRabbit_10/commit/f97b6e3b4e1333927134bc3f48e88d47e4fbb6fd

It adds a httpc_set_extra_headers() API -- you need to pass it a string with one or more headers ending in CRLF.
answered Mar 28, 2016 by TomCollins Veteran of the Digi Community (1,437 points)
...