Skip to content

Commit

Permalink
adding test for multipart match body
Browse files Browse the repository at this point in the history
  • Loading branch information
delijati committed Mar 22, 2017
1 parent 77b6b10 commit 06684f1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_body_match.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,22 @@ test('match body with empty object inside', function (t) {
t.end();
});
})

test('match body with form multipart', function(t) {

nock('http://encodingsareus.com')
.post('/', "--fixboundary\r\nContent-Disposition: form-data; name=\"field\"\r\n\r\nvalue\r\n--fixboundary--\r\n")
.reply(200);

var r = mikealRequest({
url: 'http://encodingsareus.com/',
method: 'post',
}, function(err, res) {
if (err) throw err;
assert.equal(res.statusCode, 200);
t.end();
});
var form = r.form();
form._boundary = 'fixboundary'; // fix boundary so that request could match at all
form.append('field', 'value');
});

0 comments on commit 06684f1

Please sign in to comment.