{"id":20859655,"url":"https://github.com/inlym/jsreq","last_synced_at":"2026-04-25T19:31:55.154Z","repository":{"id":109750809,"uuid":"257311270","full_name":"inlym/jsreq","owner":"inlym","description":"An easy and simple Node.js HTTP client.","archived":false,"fork":false,"pushed_at":"2020-08-13T17:04:58.000Z","size":9,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-19T07:27:50.216Z","etag":null,"topics":["http","https","javascript","node-module","nodejs","request"],"latest_commit_sha":null,"homepage":"https://github.com/inlym/jsreq","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inlym.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-20T14:44:24.000Z","updated_at":"2020-09-16T08:43:28.000Z","dependencies_parsed_at":"2023-04-13T21:46:16.664Z","dependency_job_id":null,"html_url":"https://github.com/inlym/jsreq","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inlym%2Fjsreq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inlym%2Fjsreq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inlym%2Fjsreq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inlym%2Fjsreq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inlym","download_url":"https://codeload.github.com/inlym/jsreq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243230096,"owners_count":20257645,"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":["http","https","javascript","node-module","nodejs","request"],"created_at":"2024-11-18T04:50:59.778Z","updated_at":"2025-12-11T19:23:24.410Z","avatar_url":"https://github.com/inlym.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# jsreq\n一个简单易用的Node.js HTTP请求客户端，支持Promise。\n\n\n## 安装\n使用NPM安装\n```shell\n$ npm install jsreq\n```\n\n使用CNPM安装\n```shell\n$ cnpm install jsreq\n```\n\n\n## 使用\n首先引用\n```js\nconst jsreq = require('jsreq');\n```\n\n支持多种调用方式，返回一个Promise。\n\n\n```js\nlet url = 'http://www.example.com'\nlet options = {\n    baseURL:'http://www.example.com',\n    url:'/abc',\n    path:'/path/to?name=inlym'\n    method:'POST',\n    data:'I am data',\n    headers:{\n        aaa:'aaa',\n        bbb:'bbb'\n    },\n    responseType:'text'\n}\njsreq(url,options).then(console.log).catch(console.log)  // 方式一\n\njsreq(url).then(console.log).catch(console.log)  // 方式二\n\njsreq(options).then(console.log).catch(console.log)  // 方式三\n```\n\n## 请求参数\n对于url，你可以单独拿出来放在参数的第1项，也可以放在 options 参数中。\n\n其中 options 支持以下参数\n```js\nlet options = {\n    baseURL:'http://www.example.com',\n    url:'https://www.example.com',\n    uri:'https://www.example.com',  // url的别名\n    path:'/path/to?name=inlym',\n    query:{                         // query对象\n        age:19,\n        isGood:true\n    },\n    method:'POST',\n    data:'I am data',\n    headers:{\n        aaa:'aaa',\n        bbb:'bbb'\n    },\n    responseType:'text'\n}\n```\n\n## 响应\n响应是一个对象，包含以下属性：\n\n1. statusCode\n2. statusMessage\n3. headers\n4. data\n\n例如\n```js\n{\n    statusCode:200,\n    statusMessage:'OK',\n    headers:{\n        'date': 'Mon, 30 Mar 2020 14:13:26 GMT',\n        'content-type': 'application/json; charset=utf-8',\n        'content-length': '1179',\n    },\n    data:'I am response data'\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finlym%2Fjsreq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finlym%2Fjsreq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finlym%2Fjsreq/lists"}