Comparing version 3.2.5 to 3.2.6
{ | ||
"name": "gohttp", | ||
"version": "3.2.5", | ||
"version": "3.2.6", | ||
"description": "http client for HTTP/1.1", | ||
@@ -11,3 +11,3 @@ "main": "gohttp.js", | ||
"type": "git", | ||
"url": "git+https://github.com/master-genius/httpcli.git" | ||
"url": "https://gitee.com/daoio/gohttp" | ||
}, | ||
@@ -30,5 +30,5 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/master-genius/httpcli/issues" | ||
"url": "https://gitee.com/daoio/gohttp/issues" | ||
}, | ||
"homepage": "https://github.com/master-genius/httpcli#readme" | ||
"homepage": "https://gitee.com/daoio/gohttp/blob/master/README.md" | ||
} |
@@ -53,2 +53,37 @@ | ||
## PUT请求 | ||
``` Javascript | ||
const gohttp = require('gohttp'); | ||
gohttp.put('http://localhost:2020/p', { | ||
body : { | ||
user: 'wang' | ||
} | ||
}) | ||
.then(res => { | ||
return res.text(); | ||
}) | ||
.then(result => { | ||
console.log(result); | ||
}); | ||
``` | ||
## DELETE请求 | ||
``` JavaScript | ||
const gohttp = require('gohttp'); | ||
gohttp.delete('http://localhost:2020/p/123') | ||
.then(res => { | ||
return res.text(); | ||
}) | ||
.then(result => { | ||
console.log(result); | ||
}); | ||
``` | ||
## 上传文件 | ||
@@ -70,3 +105,5 @@ | ||
] | ||
} | ||
}, | ||
//要携带表单数据需要form选项 | ||
//form : {} | ||
}) | ||
@@ -81,1 +118,36 @@ .then(res => { | ||
``` | ||
## 简单上传 | ||
基于gohttp.upload封装的up函数参数更加简单: | ||
``` JavaScript | ||
gohttp.up('http://localhost:1234/upload', { | ||
name : 'image' | ||
file : 'images/123.jpg' | ||
}).then(res => { | ||
return res.text(); | ||
}).then(d => { | ||
console.log(d); | ||
}); | ||
``` | ||
## 下载文件 | ||
``` JavaScript | ||
const gohttp = require('gohttp'); | ||
gohttp.download('https://localhost:2021/download', { | ||
dir: process.env.HOME + '/download/', | ||
//输出进度提示 | ||
progress: true | ||
}).then(d => { | ||
console.log(d || ''); | ||
}).catch(err => { | ||
console.log(err); | ||
}); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66436
14
150
1