Commit ee171f98 authored by Nicolai Kamenzky's avatar Nicolai Kamenzky
Browse files

Merge pull request #115 from EvanCarroll/master

Doc updates
parents 2854e046 c3bb0dcf
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -102,10 +102,14 @@ rp(options)


### POST data to a JSON REST API
### POST data to a JSON REST API


Set option.body to data, and json:true to encode the body as JSON. See below
for HTML forms.


``` js
``` js
var options = {
var options = {
    method: 'POST',
    method: 'POST',
    uri: 'http://posttestserver.com/post.php',
    uri: 'http://api.posttestserver.com/post',
    body: {
    body: {
        some: 'payload'
        some: 'payload'
    },
    },
@@ -123,6 +127,8 @@ rp(options)


### POST like HTML forms do
### POST like HTML forms do


Set option.form to encode the body as HTML form

``` js
``` js
var options = {
var options = {
    method: 'POST',
    method: 'POST',