Skip to content

Commit

Permalink
Add get URL
Browse files Browse the repository at this point in the history
  • Loading branch information
javalikescript committed Mar 21, 2024
1 parent 59a94bc commit 28fac9d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jls/lang/event-luv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ return class.create(function(event)
local args = table.pack(...)
local timer = luvLib.new_timer()
timer:start(timeoutMs, repeatMs, function()
if not repeatMs or repeatMs <= 0 then
if repeatMs <= 0 then
timer:close()
end
local status, err = Exception.pcall(callback, table.unpack(args, 1, args.n))
Expand Down
20 changes: 20 additions & 0 deletions jls/net/http/HttpClient.lua
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,26 @@ return class.create(function(httpClient)
end
end

function httpClient:getUrl()
local url = 'http'
if self.isSecure then
url = url..'s'
end
url = url..'://'
if self.host then
url = url..self.host
else
url = url..'localhost'
end
if self.port then
url = url..self.port
end
if self.file then
url = url..self.file
end
return url
end

function httpClient:getTcpClient()
return self.tcpClient
end
Expand Down

0 comments on commit 28fac9d

Please sign in to comment.