- Fixe string:isempty()
- Tagesschau: HTTP-Fehlercode wird jetzt vor dem JSON-Encoding geprüft
This commit is contained in:
parent
271c9c5f84
commit
2f95b6b562
@ -16,10 +16,10 @@ end
|
|||||||
|
|
||||||
function tagesschau:get_tagesschau_article(article)
|
function tagesschau:get_tagesschau_article(article)
|
||||||
local url = BASE_URL..'/'..article..'.json'
|
local url = BASE_URL..'/'..article..'.json'
|
||||||
local res,code = https.request(url)
|
local res, code = https.request(url)
|
||||||
local data = json.decode(res)
|
|
||||||
if code == 404 then return "Artikel nicht gefunden!" end
|
if code == 404 then return "Artikel nicht gefunden!" end
|
||||||
if code ~= 200 then return "HTTP-Fehler" end
|
if code ~= 200 then return "HTTP-Fehler" end
|
||||||
|
local data = json.decode(res)
|
||||||
if not data then return "HTTP-Fehler" end
|
if not data then return "HTTP-Fehler" end
|
||||||
if data.type ~= "story" then
|
if data.type ~= "story" then
|
||||||
print('Typ "'..data.type..'" wird nicht unterstützt')
|
print('Typ "'..data.type..'" wird nicht unterstützt')
|
||||||
|
@ -349,7 +349,7 @@ end
|
|||||||
|
|
||||||
-- Returns true if the string is blank/empty
|
-- Returns true if the string is blank/empty
|
||||||
function string:isempty()
|
function string:isempty()
|
||||||
self = self:trim()
|
self = utilities.trim(self)
|
||||||
return self == nil or self == ''
|
return self == nil or self == ''
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user