New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pact

Package Overview
Dependencies
Maintainers
0
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pact - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

4

HISTORY.md
# Pact History
## Version 0.1.2 (2011-03-29)
* Parse JSON responses even when the content-type includes a charset. (Ryan Grove)
## Version 0.1.1 (2011-03-29)

@@ -4,0 +8,0 @@

2

lib/http.js

@@ -21,3 +21,3 @@ /*!

response.on("end", function () {
if (response.headers["content-type"] === "application/json") {
if (/^application\/json\s*(?:;|$)/.test(response.headers["content-type"])) {
data = JSON.parse(data);

@@ -24,0 +24,0 @@ }

@@ -9,4 +9,7 @@ {

],
"version": "0.1.1",
"version": "0.1.2",
"author": "Reid Burke <me@reidburke.com> (http://reidburke.com/)",
"contributors" : [
"Ryan Grove <ryan@wonko.com>"
],
"main": "index",

@@ -13,0 +16,0 @@ "directories": {

@@ -19,3 +19,3 @@ /*!

}), port).apply(this);
}
};
}

@@ -44,2 +44,26 @@

}
},
},
'A JSON API' : {
topic: mockServer(function(req, res) {
if (req.url === '/') {
res.writeHead(200, {'Content-Type': 'application/json'});
} else if (req.url == '/with-charset') {
res.writeHead(200, {'Content-Type': 'application/json;charset=utf-8'});
}
res.end('{"foo": "bar"}');
}),
'when / is requested' : {
topic: pact.request(),
'contains a parsed JSON response object' : function(topic) {
assert.isObject(topic.body);
assert.strictEqual(topic.body.foo, 'bar');
}
},
'when /with-charset is requested' : {
topic: pact.request(),
'contains a parsed JSON response object' : function(topic) {
assert.isObject(topic.body);
assert.strictEqual(topic.body.foo, 'bar');
}
}

@@ -46,0 +70,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc