mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 11:25:29 -04:00
Pass status code and headers to plugin scripts
This commit is contained in:
parent
33107670ce
commit
3b315ad880
@ -238,9 +238,22 @@ class Plugin
|
|||||||
end
|
end
|
||||||
|
|
||||||
res = HTTP::Client.get url, headers
|
res = HTTP::Client.get url, headers
|
||||||
body = res.body
|
|
||||||
|
|
||||||
env.push_string body
|
env.push_object
|
||||||
|
|
||||||
|
env.push_int res.status_code
|
||||||
|
env.put_prop_string -2, "status_code"
|
||||||
|
|
||||||
|
env.push_string res.body
|
||||||
|
env.put_prop_string -2, "body"
|
||||||
|
|
||||||
|
env.push_object
|
||||||
|
res.headers.each do |k, v|
|
||||||
|
env.push_string v.to_s
|
||||||
|
env.put_prop_string -2, k
|
||||||
|
end
|
||||||
|
env.put_prop_string -2, "headers"
|
||||||
|
|
||||||
env.call_success
|
env.call_success
|
||||||
end
|
end
|
||||||
sbx.put_prop_string -2, "get"
|
sbx.put_prop_string -2, "get"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user