I’m using basic authentication to log in to my web service over https, however the variable output of r is only returning the value of 1, making json.decode ineffective. How do I perform basic authentication and return the json query after successfully authenticating? Thanks in advance.
local json = require("json")
local ssl = require( "plugin.openssl" )
local http = require('plugin_luasec_https')
local mime = require("mime")
local URL = "https://127.0.0.1/example/default/call/json/testing/"
local r, c = http.request {
url = URL,
headers = { authentication = "Basic " .. (mime.b64("username:passwd")) }
}
print(r)
print(c)
if r == nil then do
end
else
local data, pos, msg = json.decode(r)
end