mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-06-25 22:53:22 +00:00
47721bf76b
For instance, `pastebin run https://pastebin.com/LYAxmSby` will now extract the code and download appropriately. Also add an error message when we received something which is not a valid pastebin code. See #134.
20 lines
929 B
Lua
20 lines
929 B
Lua
describe("The http library", function()
|
|
describe("http.checkURL", function()
|
|
it("accepts well formed domains", function()
|
|
expect({ http.checkURL("https://google.com")}):same({ true })
|
|
end)
|
|
|
|
it("rejects malformed URLs", function()
|
|
expect({ http.checkURL("google.com")}):same({ false, "Must specify http or https" })
|
|
expect({ http.checkURL("https:google.com")}):same({ false, "URL malformed" })
|
|
expect({ http.checkURL("https:/google.com")}):same({ false, "URL malformed" })
|
|
expect({ http.checkURL("wss://google.com")}):same({ false, "Invalid protocol 'wss'" })
|
|
end)
|
|
|
|
it("rejects local domains", function()
|
|
expect({ http.checkURL("http://localhost")}):same({ false, "Domain not permitted" })
|
|
expect({ http.checkURL("http://127.0.0.1")}):same({ false, "Domain not permitted" })
|
|
end)
|
|
end)
|
|
end)
|