This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

http.request & body
#1
Hi all,

is ther any way to add a "body" string as parameter of the http.request, as it's possible to do it with "header" ?

Many thank's in advance for your help.

All the best from France
Reply
#2
Second parameter for the request function is body when using simple form: http.request(url, body)
Reply
#3
I thnik I'm not using a simple form...
I have to integrate as body '{"time":"2020-06-09 16:27:36"}' for a REST process, in the following lines.


local res, err = http.request({
url = url,
method = 'POST',
-- protocol = 'tlsv12' -- only for old LM firmware
headers = headers,
sink = ltn12.sink.table(resp),
source = ltn12.source.string(data)
})
Reply
#4
See this: https://forum.logicmachine.net/showthrea...4#pid17034
Reply
#5
Ok Admin,

I founded the "source" parameter to pass my REST/Json command body.
Know it works fine !

Thank's and have a good end of week.
Reply


Forum Jump: