var deepEqual = require('assert').deepEqual;
var qs = require('querystring');

module.exports =
function matchBody(spec, body) {
  if (typeof spec == 'undefined') return true;
  var options = this || {};

  if (Buffer.isBuffer(body))
    body = body.toString();

  // try to transform body to json
  var json;
  if (typeof spec == 'object') {
    try { json = JSON.parse(body);} catch(err) {}
    if (json !== undefined) body = json;
    else
      if (
        (typeof spec == 'object') &&
        options.headers &&
        options.headers['content-type'] &&
        options.headers['content-type'].match(/application\/x-www-form-urlencoded/))
      {
        body = qs.parse(body);
      }
  }

  try {
    deepEqual(spec, body);
    return true;
  } catch(err) {
    return false;
  }

};
@@ -303,16 +303,47 @@
 r json;%0A
+  console.log(options.headers)%0A
   if (ty
@@ -538,27 +538,58 @@
 .headers
- &&%0A       
+%0A      )%0A      %7B%0A        var contentType =
  options
@@ -602,33 +602,53 @@
 rs%5B'
-c
+C
 ontent-
-t
+T
 ype'%5D
- &&%0A
+%0A                     
        
+%7C%7C
  opt
@@ -675,16 +675,42 @@
 t-type'%5D
+;%0A%0A        if (contentType
 .match(/
@@ -746,33 +746,29 @@
 coded/))
+ %7B
 %0A     
- %7B%0A
      
-   
 body = q
@@ -778,24 +778,34 @@
 arse(body);%0A
+        %7D%0A
       %7D%0A  %7D%0A
@@ -899,8 +899,9 @@
 %0A  %7D%0A%0A%7D;
+%0A

Content-Type header can be capitalized