{"id":13636307,"url":"https://github.com/bakins/lua-resty-http-simple","last_synced_at":"2025-04-19T08:31:53.188Z","repository":{"id":7331198,"uuid":"8652607","full_name":"bakins/lua-resty-http-simple","owner":"bakins","description":"Lua HTTP client driver for ngx_lua","archived":false,"fork":true,"pushed_at":"2014-11-05T21:49:59.000Z","size":360,"stargazers_count":74,"open_issues_count":2,"forks_count":21,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-02-14T17:32:14.762Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"bsm/lua-resty-http","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bakins.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-08T14:35:54.000Z","updated_at":"2023-11-01T05:50:27.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/bakins/lua-resty-http-simple","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakins%2Flua-resty-http-simple","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakins%2Flua-resty-http-simple/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakins%2Flua-resty-http-simple/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakins%2Flua-resty-http-simple/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bakins","download_url":"https://codeload.github.com/bakins/lua-resty-http-simple/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223795219,"owners_count":17204135,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T00:00:59.769Z","updated_at":"2024-11-09T06:30:16.426Z","avatar_url":"https://github.com/bakins.png","language":"Lua","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"Name\n====\n\nlua-resty-http -simple- Simple Lua HTTP client driver for ngx_lua\n\nExample\n=======\n\n    server {\n      location /test {\n        content_by_lua '\n          local http   = require \"resty.http.simple\"\n\n          local res, err = http.request(\"checkip.amazonaws.com\", 80, {\n          headers = { Cookie = \"foo=bar\"} })\n          if not res then\n            ngx.say(\"http failure: \", err)\n            return\n          end\n\n          if res.status \u003e= 200 and res.status \u003c 300 then\n            ngx.say(\"My IP is: \" .. res.body)\n          else\n            ngx.say(\"Query returned a non-200 response: \" .. res.status)\n          end\n        ';\n      }\n    }\n\nAPI\n===\n\nrequest\n---\n`syntax: local res, err = http.request(host, port, options?)`\n\nPerform an http request.\n\nBefore actually resolving the host name and connecting to the remote\nbackend, this method will always look up the connection pool for\nmatched idle connections created by previous calls of this\nmethod. This allows the module to handle HTTP keep alives.\n\nAn optional Lua `options` table can be specified to declare various options:\n\n* `method`\n: Specifies the request method, defaults to `GET`.\n* `path`\n: Specifies the path, defaults to `'/'`.\n* `query`\n: Specifies query parameters. Accepts either a string or a Lua table.\n* `headers`\n: Specifies request headers. Accepts a Lua table. \n* `body`\n: Specifies request body for POST method. Only accepts a string.\n* `timeout`\n: Sets the timeout in milliseconds for network operations. Defaults to `5000`.\n* `version`\n: Sets the HTTP version. Use `0` for HTTP/1.0 and `1` for\nHTTP/1.1. Defaults to `1`.\n* `maxsize`\n: Sets the maximum size in bytes to fetch. A response body larger than\nthis will cause the fucntion to return a `exceeds maxsize`\nerror. Defaults to `nil` which means no limit.\n\n\nReturns a `res` object containing three attributes:\n\n* `res.status` (number)\n: The resonse status, e.g. 200\n* `res.headers` (table)\n: A Lua table with response headers. \n* `res.body` (string)\n: The plain response body\n\n**Note** All headers (request and response) are noramlized for\ncapitalization - e.g., Accept-Encoding, ETag, Foo-Bar, Baz - in the\nnormal HTTP \"standard.\"\n\nLicence\n=======\n\nStarted life as a fork of\n[lua-resty-http](https://github.com/bsm/lua-resty-http) - Copyright (c) 2013 Black Square Media Ltd\n\nThis code is covered by MIT License. \n\nCopyright (C) 2013, by Brian Akins \u003cbrian@akins.org\u003e.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbakins%2Flua-resty-http-simple","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbakins%2Flua-resty-http-simple","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbakins%2Flua-resty-http-simple/lists"}