Skip to content

Commit

Permalink
updated to better differentiate json/html forms because underlying re…
Browse files Browse the repository at this point in the history
…quest.pm is really bad at giving a sane error here.
  • Loading branch information
EvanCarroll committed May 16, 2016
1 parent 2854e04 commit c3bb0dc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,14 @@ rp(options)

### 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
var options = {
method: 'POST',
uri: 'http://posttestserver.com/post.php',
uri: 'http://api.posttestserver.com/post',
body: {
some: 'payload'
},
Expand All @@ -123,6 +127,8 @@ rp(options)

### POST like HTML forms do

Set option.form to encode the body as HTML form

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

0 comments on commit c3bb0dc

Please sign in to comment.