From 06684f11caac488a9bf1b803d45a1083b89e1263 Mon Sep 17 00:00:00 2001 From: Josip Delic Date: Wed, 22 Mar 2017 18:08:41 +0100 Subject: [PATCH] adding test for multipart match body --- tests/test_body_match.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test_body_match.js b/tests/test_body_match.js index 25e518826..fb645cbe2 100644 --- a/tests/test_body_match.js +++ b/tests/test_body_match.js @@ -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'); +});