Repository: node-nock/nock (js)

Issue:
Request body specs don't allow regex within array.
For example, the following nock will never match a POSTed payload, because the regex property test is nested within an array:

```javascript
nock('my.api.com')
  .post('/resource', {
    messages: [{
      from: '15555555555',
      destinations: [{
        to: '15555555555'
      }],
      text: 'testing.. 123',
      validityPeriod: /\d*/,
      sendAt: /.+/
    }]
  })
```

Looks like this is because `deepEqualExtended` hands off to the `deep-equal` library as soon as something that is not an object or regex is encountered, so the regex matching logic is lost as soon as an array is hit.

Pull request description:
Handle arrays like objects in match_body
Closes #715 and does not appear to cause any regressions.

Patch:
diff --git a/lib/match_body.js b/lib/match_body.js
index bcfd53b..e5346e0 100644
--- a/lib/match_body.js
+++ b/lib/match_body.js
@@ -57,7 +57,7 @@ function deepEqualExtended(spec, body) {
   if (spec && spec.constructor === RegExp) {
     return spec.test(body);
   }
-  if (spec && spec.constructor === Object && body) {
+  if (spec && spec.constructor === Object || spec.constructor === Array && body) {
     var keys = Object.keys(spec);
     for (var i = 0; i < keys.length; i++) {
       if (!deepEqualExtended(spec[keys[i]], body[keys[i]])) {


Test patch:
diff --git a/tests/test_body_match.js b/tests/test_body_match.js
index 5519a35..23f9225 100644
--- a/tests/test_body_match.js
+++ b/tests/test_body_match.js
@@ -26,3 +26,24 @@ test('match body with regex', function (t) {
   });
 
 });
+
+test('match body with regex inside array', function (t) {
+
+  nock('http://encodingsareus.com')
+    .post('/', {items: [{name: /t.+/}]})
+    .reply(200);
+
+  mikealRequest({
+    url: 'http://encodingsareus.com/',
+    method: 'post',
+    json: {
+      items: [{
+        name: 'test'
+      }]
+    },
+  }, function(err, res) {
+    if (err) throw err;
+    assert.equal(res.statusCode, 200);
+    t.end();
+  });
+})