mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-23 19:43:09 +00:00
add httpc
This commit is contained in:
16
test/testhttp.lua
Normal file
16
test/testhttp.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
local skynet = require "skynet"
|
||||
local httpc = require "http.httpc"
|
||||
|
||||
skynet.start(function()
|
||||
print("GET www.baidu.com")
|
||||
local header = {}
|
||||
local status, body = httpc.get("baidu.com", "/", header)
|
||||
print("[header] =====>")
|
||||
for k,v in pairs(header) do
|
||||
print(k,v)
|
||||
end
|
||||
print("[body] =====>", status)
|
||||
print(body)
|
||||
|
||||
skynet.exit()
|
||||
end)
|
||||
Reference in New Issue
Block a user