mirror of
https://github.com/CryptKeeperZK/ejs.git
synced 2026-01-09 07:27:56 -05:00
Merge pull request #606 from tracylv/master
Add a "POST" example for request
This commit is contained in:
@@ -895,11 +895,19 @@ Sends requests to the given url sending any data if the method is POST or PUT
|
||||
|
||||
#####Examples
|
||||
```
|
||||
// 'GET' request
|
||||
request({url: 'google.com', method: 'GET'}, function (err, data) {
|
||||
if (err) { throw err; }
|
||||
|
||||
console.log(data)
|
||||
})
|
||||
|
||||
// 'POST' request
|
||||
request({url: 'google.com', data: geddy.uri.paramify({name: 'geddy', key: 'geddykey'}), headers: {'Content-Type': 'application/x-www-form-urlencoded'}, method: 'POST' }, function (err, data) {
|
||||
if (err) { throw err; }
|
||||
|
||||
console.log(data)
|
||||
})
|
||||
```
|
||||
|
||||
* * *
|
||||
@@ -1417,4 +1425,4 @@ Inflection returns an object that contains different inflections created from th
|
||||
```
|
||||
getInflections('user')
|
||||
// => {filename: { ... }, constructor: { ... }, property: { ... }}
|
||||
```
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user