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.

https function
#2
Do not set the source if payload is not provided:
Code:
local source

if payload then
  source = ltn12.source.string(payload)
end

...

local res, err, res_headers, status = htps.request({
  ...
  source = source, -- source will be nil if payload is not provided
  ...
})

There's another issue with your code when payload or add_headers are set: ip/port variables are not set, so the function call will produce an error. You can use socket.url to parse the url into parts: http://w3.impa.br/~diego/software/luasoc...html#parse
Reply


Messages In This Thread
https function - by benanderson_475 - 19.02.2021, 22:22
RE: https function - by admin - 22.02.2021, 07:21

Forum Jump: