Lua socket HTTP getting connection refused -


i'm trying create function creates issue github repository using lua socket.http, i'm getting connection refused everytime. documentation socket bit unclear , couldn't find more helpful information on why request getting refused every time. tried following:

local config = {     token = "oauth token github" }  local http, ltn12 = require("socket.http"), require("ltn12") local payload = '{"title": "test", "body": "test body", "labels": ["bug"]}' local response, status, headers, line = http.request("https://api.github.com/repos/<username>/<repository>/issues?access_token=" .. config.token, payload) 

so checked again how , there second form request. i'm trying following:

local response = {} local _, status, headers, line = http.request{     url = "https://api.github.com/repos/<username>/<repository>/issues",     sink = ltn12.sink.table(response),     method = "post",     headers = {         ["authorization"] = "token " .. config.token,         ["content-length"] = payload:len()     },     source = ltn12.source.string(payload) } 

according socket documentation, should make post request url sending payload body. if print(status) prints connection refused.

i'm ignoring first return value 1.

i tried manually issuing request using curl:

curl -h "authorization: token <oauth token github>" https://api.github.com/repos/<username>/<repository>/issues -xpost -d '{"title": "test", "body": "{"title": "test", "body": "test body", "labels": ["bug"]}' 

and posted issue properly. still can't figure out happening connection getting refused.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -