@pact-foundation/pact-node
Advanced tools
Comparing version 4.0.3 to 4.1.0
{ | ||
"name": "@pact-foundation/pact-node", | ||
"version": "4.0.3", | ||
"version": "4.1.0", | ||
"description": "A wrapper for the Ruby version of Pact to work within Node", | ||
@@ -41,3 +41,3 @@ "main": "./src/pact.js", | ||
"@pact-foundation/pact-mock-service": "0.8.7", | ||
"@pact-foundation/pact-provider-verifier": "0.0.6", | ||
"@pact-foundation/pact-provider-verifier": "0.0.12", | ||
"bluebird": "^3.3.5", | ||
@@ -52,3 +52,4 @@ "bunyan": "^1.8.0", | ||
"superagent-bluebird-promise": "^3.0.0", | ||
"underscore": "^1.8.3" | ||
"underscore": "^1.8.3", | ||
"unixify": "^0.2.1" | ||
}, | ||
@@ -60,6 +61,6 @@ "optionalDependencies": { | ||
"@pact-foundation/pact-mock-service-linux-ia32": "0.8.7", | ||
"@pact-foundation/pact-provider-verifier-darwin": "0.0.6", | ||
"@pact-foundation/pact-provider-verifier-linux-ia32": "0.0.6", | ||
"@pact-foundation/pact-provider-verifier-linux-x64": "0.0.6", | ||
"@pact-foundation/pact-provider-verifier-win32": "0.0.6" | ||
"@pact-foundation/pact-provider-verifier-darwin": "0.0.12", | ||
"@pact-foundation/pact-provider-verifier-linux-ia32": "0.0.12", | ||
"@pact-foundation/pact-provider-verifier-linux-x64": "0.0.12", | ||
"@pact-foundation/pact-provider-verifier-win32": "0.0.12" | ||
}, | ||
@@ -80,2 +81,3 @@ "bin": { | ||
"nodemon": "^1.4.1", | ||
"rewire": "^2.5.1", | ||
"rimraf": "^2.4.2", | ||
@@ -82,0 +84,0 @@ "sinon": "^1.15.4" |
@@ -1,7 +0,10 @@ | ||
var bunyan = require('bunyan'); | ||
var pkg = require('../package.json'); | ||
var PrettyStream = require('bunyan-prettystream'); | ||
var prettyStdOut = new PrettyStream(); | ||
var bunyan = require('bunyan'), | ||
pkg = require('../package.json'), | ||
_ = require('underscore'), | ||
PrettyStream = require('bunyan-prettystream'), | ||
prettyStdOut = new PrettyStream(); | ||
prettyStdOut.pipe(process.stdout); | ||
var config = { | ||
@@ -8,0 +11,0 @@ name: 'pact-node@' + pkg.version, |
@@ -6,5 +6,4 @@ 'use strict'; | ||
serverFactory = require('./server'), | ||
// TODO: uncomment when fixed | ||
/*verifierFactory = require('./verifier'), | ||
publisherFactory = require('./publisher'),*/ | ||
verifierFactory = require('./verifier'), | ||
publisherFactory = require('./publisher'), | ||
q = require('q'); | ||
@@ -15,9 +14,9 @@ | ||
function stringify(obj) { | ||
var arr = []; | ||
for (var k in obj) { | ||
if (obj[k] !== undefined) { | ||
arr.push(k + '=' + obj[k]); | ||
} | ||
} | ||
return arr.join(', '); | ||
return _.chain(obj) | ||
.pairs() | ||
.map(function(v){ | ||
return v.join(' = '); | ||
}) | ||
.value() | ||
.join(',\n'); | ||
} | ||
@@ -27,3 +26,5 @@ | ||
function createServer(options) { | ||
if (options && options.port && _.some(servers, function (s) { return s.options.port == options.port })) { | ||
if (options && options.port && _.some(servers, function (s) { | ||
return s.options.port == options.port | ||
})) { | ||
var msg = 'Port `' + options.port + '` is already in use by another process.'; | ||
@@ -36,7 +37,7 @@ logger.error(msg); | ||
servers.push(server); | ||
logger.info('Creating Pact Server with options: ' + stringify(server.options)); | ||
logger.info('Creating Pact Server with options: \n' + stringify(server.options)); | ||
// Listen to server delete events, to remove from server list | ||
server.once('delete', function (server) { | ||
logger.info('Deleting Pact Server with options: ' + stringify(server.options)); | ||
logger.info('Deleting Pact Server with options: \n' + stringify(server.options)); | ||
servers = _.without(servers, server); | ||
@@ -63,3 +64,3 @@ }); | ||
// Run the Pact Verification process | ||
/*function verifyPacts(options) { | ||
function verifyPacts(options) { | ||
logger.info('Verifying Pacts.'); | ||
@@ -73,3 +74,3 @@ return verifierFactory(options).verify(); | ||
return publisherFactory(options).publish(); | ||
}*/ | ||
} | ||
@@ -82,9 +83,8 @@ // Listen for Node exiting or someone killing the process | ||
module.exports = { | ||
logLevel: logger.level, | ||
createServer: createServer, | ||
listServers: listServers, | ||
removeAllServers: removeAllServers | ||
// TODO: remove comments when tests fixed | ||
/*, | ||
verifyPacts: verifyPacts, | ||
publishPacts: publishPacts*/ | ||
removeAllServers: removeAllServers, | ||
verifyPacts: verifyPacts, | ||
publishPacts: publishPacts | ||
}; |
@@ -5,2 +5,3 @@ /* global describe:true, before:true, after:true, it:true, global:true, process:true */ | ||
pact = require('./pact.js'), | ||
logger = require('./logger.js'), | ||
path = require('path'); | ||
@@ -14,2 +15,6 @@ chai = require("chai"), | ||
describe("Pact Spec", function () { | ||
before(function(){ | ||
logger.level('debug'); | ||
}); | ||
afterEach(function (done) { | ||
@@ -16,0 +21,0 @@ pact.removeAllServers().then(function () { |
@@ -34,5 +34,4 @@ 'use strict'; | ||
if (fs.statSync(path.normalize(uri)).isDirectory()) { | ||
logger.debug('we are a dir: ' + uri) | ||
logger.debug('we are a dir: ' + uri); | ||
_.each(fs.readdirSync(uri, ''), function (file) { | ||
// Ends with .json | ||
@@ -72,3 +71,3 @@ if (file.indexOf('.json', file.length - 5) === file.length - 5) { | ||
logger.debug(uploadRequests.length) | ||
logger.debug(uploadRequests.length); | ||
@@ -75,0 +74,0 @@ // Return a merge of all promises... |
/* global describe:true, before:true, after:true, it:true, global:true, process:true */ | ||
var serverFactory = require('./server.js'), | ||
var serverFactory = require('./server'), | ||
logger = require('./logger'), | ||
expect = require('chai').expect, | ||
@@ -11,2 +12,6 @@ fs = require('fs'), | ||
before(function () { | ||
logger.level('debug'); | ||
}); | ||
afterEach(function (done) { | ||
@@ -13,0 +18,0 @@ if (server) { |
@@ -10,4 +10,4 @@ 'use strict'; | ||
q = require('q'), | ||
eventEmitter = require('events').EventEmitter, | ||
util = require('util'); | ||
unixify = require('unixify'), | ||
url = require('url'); | ||
var isWindows = process.platform === 'win32'; | ||
@@ -33,13 +33,32 @@ | ||
util.inherits(Verifier, eventEmitter); | ||
// Converts a path to unixy stuff | ||
function sanitisePath(str) { | ||
var isExtendedLengthPath = /^\\\\\?\\/.test(str); | ||
var hasNonAscii = /[^\x00-\x80]+/.test(str); | ||
if (isExtendedLengthPath || hasNonAscii) { | ||
return str; | ||
} | ||
// var str = 'c:\\test\\pact.json'; | ||
str = str.replace(/\\/g, '/'); | ||
str = str.replace(/[a-zA-Z]+:/, ''); | ||
return str | ||
} | ||
Verifier.prototype.verify = function () { | ||
logger.info("Verifier verify()"); | ||
var deferred = q.defer(); | ||
this.emit('start', this); | ||
var envVars = JSON.parse(JSON.stringify(process.env)); // Create copy of environment variables | ||
// Remove environment variable if there | ||
// This is a hack to prevent some weird Travelling Ruby behaviour with Gems | ||
// https://github.com/pact-foundation/pact-mock-service-npm/issues/16 | ||
delete envVars['RUBYGEMS_GEMDEPS']; | ||
var file, | ||
opts = { | ||
cwd: path.resolve(packagePath, '..', 'bin'), | ||
detached: !isWindows | ||
detached: !isWindows, | ||
env: envVars | ||
}, | ||
@@ -53,7 +72,6 @@ mapping = { | ||
'pactBrokerPassword': '--broker-password' | ||
}, | ||
exitCode = 0; | ||
}; | ||
var args = _.compact(_.map(mapping, (function (value, key) { | ||
return this.options[key] ? value + ' ' + this.options[key] : null; | ||
return this.options[key] ? value + ' ' + (checkTypes.array(this.options[key]) ? this.options[key].join(',') : this.options[key]) : null; | ||
}).bind(this))); | ||
@@ -73,28 +91,22 @@ | ||
this.instance = cp.exec(cmd, opts, function (err, stdOut, stdErr) { | ||
if (err) { | ||
logger.error(err); | ||
} | ||
if (stdErr) { | ||
logger.error(stdErr); | ||
} | ||
if (stdOut) { | ||
logger.debug(stdOut); | ||
} | ||
if (exitCode == 0) { | ||
logger.info('Pact Verification failed.'); | ||
deferred.resolve(); | ||
} else { | ||
logger.info('Pact Verification succeeded.'); | ||
deferred.reject(); | ||
} | ||
}); | ||
this.instance = cp.spawn(file, args, opts); | ||
this.instance.on('error', console.error); | ||
this.instance.on('exit', function (code, signal) { | ||
exitCode = code; | ||
this.instance.stdout.setEncoding('utf8'); | ||
this.instance.stdout.on('data', logger.debug.bind(logger)); | ||
this.instance.stderr.setEncoding('utf8'); | ||
this.instance.stderr.on('data', logger.debug.bind(logger)); | ||
this.instance.on('error', logger.error.bind(logger)); | ||
this.instance.once('close', function (code) { | ||
code == 0 ? deferred.resolve() : deferred.reject(); | ||
}); | ||
logger.info('Created Pact Verifier process with PID: ' + this.instance.pid); | ||
return deferred.promise; | ||
return deferred.promise.then(function () { | ||
logger.info('Pact Verification succeeded.'); | ||
}, function () { | ||
var msg = 'Pact Verification failed.'; | ||
logger.error(msg); | ||
return q.reject(msg); | ||
}); | ||
}; | ||
@@ -110,13 +122,19 @@ | ||
var url = require('url') | ||
_.each(options.pactUrls, function(uri) { | ||
// only check local files | ||
var proto = url.parse(uri).protocol; | ||
if (proto == 'file://' || proto === null) { | ||
options.pactUrls = _.map(options.pactUrls, function (uri) { | ||
// only check local files | ||
if (!/https?:/.test(url.parse(uri).protocol)) { // If it's not a URL, check if file is available | ||
try { | ||
fs.statSync(path.normalize(uri)) | ||
} catch(e) { | ||
fs.statSync(path.normalize(uri)).isFile(); | ||
// Unixify the paths. Pact in multiple places uses URI and matching and | ||
// hasn't really taken Windows into account. This is much easier, albeit | ||
// might be a problem on non root-drives | ||
// options.pactUrls.push(uri); | ||
return unixify(uri); | ||
} catch (e) { | ||
throw new Error('Pact file: "' + uri + '" doesn\'t exist'); | ||
} | ||
} | ||
// HTTP paths are OK | ||
return uri; | ||
}); | ||
@@ -143,3 +161,3 @@ | ||
if ( (options.providerStatesUrl && !options.providerStatesSetupUrl) || (options.providerStatesSetupUrl && !options.providerStatesUrl)) { | ||
if ((options.providerStatesUrl && !options.providerStatesSetupUrl) || (options.providerStatesSetupUrl && !options.providerStatesUrl)) { | ||
throw new Error('Must provide both or none of --provider-states-url and --provider-states-setup-url.'); | ||
@@ -146,0 +164,0 @@ } |
var cors = require('cors'), | ||
_ = require('underscore'), | ||
express = require('express') | ||
bodyParser = require('body-parser'), | ||
basicAuth = require('basic-auth'), | ||
server = express(); | ||
_ = require('underscore'), | ||
express = require('express'), | ||
bodyParser = require('body-parser'), | ||
basicAuth = require('basic-auth'), | ||
server = express(); | ||
server.use(cors()); | ||
server.use(bodyParser.json()); | ||
server.use(bodyParser.urlencoded({ extended: true })); | ||
server.use(bodyParser.urlencoded({extended: true})); | ||
var pactFunction = function(req, res) { | ||
// Double check a few things | ||
// 1. Is there a body? | ||
if (_.isEmpty(req.body)) { | ||
return res.sendStatus(400); | ||
} | ||
// 2. Is there a consumer, provider and version in the request? | ||
if (_.isEmpty(req.params.consumer) || _.isEmpty(req.params.provider || _.isEmpty(req.params.version))) { | ||
return res.sendStatus(400); | ||
} | ||
res.json(req.body); | ||
var pactFunction = function (req, res) { | ||
if ( | ||
// 1. Is there a body? | ||
_.isEmpty(req.body) || | ||
// 2. Is there a consumer, provider and version in the request? | ||
_.isEmpty(req.params.consumer) || _.isEmpty(req.params.provider) || _.isEmpty(req.params.version) | ||
) { | ||
return res.sendStatus(400); | ||
} | ||
res.json(req.body); | ||
}; | ||
@@ -30,21 +26,11 @@ | ||
var auth = function (req, res, next) { | ||
function unauthorized(res) { | ||
res.set('WWW-Authenticate', 'Basic realm=Authorization Required'); | ||
return res.send(401); | ||
}; | ||
var user = basicAuth(req); | ||
if (!user || !user.name || !user.pass) { | ||
return unauthorized(res); | ||
}; | ||
if (user.name === 'foo' && user.pass === 'bar') { | ||
return next(); | ||
} else { | ||
return unauthorized(res); | ||
}; | ||
var user = basicAuth(req); | ||
if (user && user.name === 'foo' && user.pass === 'bar') { | ||
return next(); | ||
} else { | ||
res.set('WWW-Authenticate', 'Basic realm=Authorization Required'); | ||
return res.sendStatus(401); | ||
} | ||
}; | ||
// Pretend to be a Pact Broker (https://github.com/bethesque/pact_broker) for integration tests | ||
@@ -56,2 +42,2 @@ server.put('/pacts/provider/:provider/consumer/:consumer/version/:version', pactFunction); | ||
module.exports = server | ||
module.exports = server; |
var cors = require('cors'), | ||
express = require('express') | ||
bodyParser = require('body-parser'), | ||
basicAuth = require('basic-auth'); | ||
express = require('express'), | ||
bodyParser = require('body-parser'), | ||
basicAuth = require('basic-auth'); | ||
@@ -9,47 +9,47 @@ var server = express(); | ||
server.use(bodyParser.json()); | ||
server.use(bodyParser.urlencoded({ extended: true })); | ||
server.use(bodyParser.urlencoded({extended: true})); | ||
var stateData = ""; | ||
server.get('/', function(req, res) { | ||
res.json({ greeting: 'Hello' }); | ||
server.get('/', function (req, res) { | ||
res.json({greeting: 'Hello'}); | ||
}); | ||
server.get('/fail', function(req, res) { | ||
res.json({ greeting: 'Oh noes!' }); | ||
server.get('/fail', function (req, res) { | ||
res.json({greeting: 'Oh noes!'}); | ||
}); | ||
server.get('/provider-states', function(req, res) { | ||
res.json({ me: ["There is a greeting"], anotherclient: ["There is a greeting"] }); | ||
server.get('/provider-states', function (req, res) { | ||
res.json({me: ["There is a greeting"], anotherclient: ["There is a greeting"]}); | ||
}); | ||
server.post('/provider-state', function(req, res) { | ||
stateData = "State data!"; | ||
res.json({ greeting: stateData }); | ||
server.post('/provider-state', function (req, res) { | ||
stateData = "State data!"; | ||
res.json({greeting: stateData}); | ||
}); | ||
server.get('/somestate', function(req, res) { | ||
res.json({ greeting: stateData }); | ||
server.get('/somestate', function (req, res) { | ||
res.json({greeting: stateData}); | ||
}); | ||
server.get('/contract/:name', function(req, res) { | ||
var options = { | ||
root: __dirname, | ||
dotfiles: 'deny', | ||
headers: { | ||
'x-timestamp': Date.now(), | ||
'x-sent': true | ||
} | ||
}; | ||
server.get('/contract/:name', function (req, res) { | ||
var options = { | ||
root: __dirname, | ||
dotfiles: 'deny', | ||
headers: { | ||
'x-timestamp': Date.now(), | ||
'x-sent': true | ||
} | ||
}; | ||
var fileName = req.params.name; | ||
res.sendFile(fileName, options, function (err) { | ||
if (err) { | ||
console.log(err); | ||
res.status(err.status).end(); | ||
} | ||
else { | ||
console.log('Sent:', fileName); | ||
} | ||
}); | ||
var fileName = req.params.name; | ||
res.sendFile(fileName, options, function (err) { | ||
if (err) { | ||
console.log(err); | ||
res.status(err.status).end(); | ||
} | ||
else { | ||
console.log('Sent:', fileName); | ||
} | ||
}); | ||
}); | ||
@@ -60,40 +60,31 @@ | ||
var auth = function (req, res, next) { | ||
function unauthorized(res) { | ||
res.set('WWW-Authenticate', 'Basic realm=Authorization Required'); | ||
return res.send(401); | ||
}; | ||
var user = basicAuth(req); | ||
if (!user || !user.name || !user.pass) { | ||
return unauthorized(res); | ||
}; | ||
if (user.name === 'foo' && user.pass === 'bar') { | ||
return next(); | ||
} else { | ||
return unauthorized(res); | ||
}; | ||
var user = basicAuth(req); | ||
if (user && user.name === 'foo' && user.pass === 'bar') { | ||
return next(); | ||
} else { | ||
res.set('WWW-Authenticate', 'Basic realm=Authorization Required'); | ||
return res.sendStatus(401); | ||
} | ||
}; | ||
server.get('/pacts/provider/they/consumer/me/latest', auth, function (req, res) { | ||
var obj = JSON.parse('{"consumer":{"name":"me"},"provider":{"name":"they"},"interactions":[{"description":"Provider state success","provider_state":"There is a greeting","request":{"method":"GET","path":"/somestate"},"response":{"status":200,"headers":{},"body":{"greeting":"State data!"}}}],"metadata":{"pactSpecificationVersion":"2.0.0"},"updatedAt":"2016-05-15T00:09:33+00:00","createdAt":"2016-05-15T00:09:06+00:00","_links":{"self":{"title":"Pact","name":"Pact between me (v1.0.0) and they","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0"},"pb:consumer":{"title":"Consumer","name":"me","href":"http://pact.onegeek.com.au/pacticipants/me"},"pb:provider":{"title":"Provider","name":"they","href":"http://pact.onegeek.com.au/pacticipants/they"},"pb:latest-pact-version":{"title":"Pact","name":"Latest version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/latest"},"pb:previous-distinct":{"title":"Pact","name":"Previous distinct version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0/previous-distinct"},"pb:diff-previous-distinct":{"title":"Diff","name":"Diff with previous distinct version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0/diff/previous-distinct"},"pb:pact-webhooks":{"title":"Webhooks for the pact between me and they","href":"http://pact.onegeek.com.au/webhooks/provider/they/consumer/me"},"pb:tag-prod-version":{"title":"Tag this version as \'production\'","href":"http://pact.onegeek.com.au/pacticipants/me/versions/1.0.0/tags/prod"},"pb:tag-version":{"title":"Tag version","href":"http://pact.onegeek.com.au/pacticipants/me/versions/1.0.0/tags/{tag}"},"curies":[{"name":"pb","href":"http://pact.onegeek.com.au/doc/{rel}","templated":true}]}}'); | ||
res.json(obj); | ||
var obj = JSON.parse('{"consumer":{"name":"me"},"provider":{"name":"they"},"interactions":[{"description":"Provider state success","provider_state":"There is a greeting","request":{"method":"GET","path":"/somestate"},"response":{"status":200,"headers":{},"body":{"greeting":"State data!"}}}],"metadata":{"pactSpecificationVersion":"2.0.0"},"updatedAt":"2016-05-15T00:09:33+00:00","createdAt":"2016-05-15T00:09:06+00:00","_links":{"self":{"title":"Pact","name":"Pact between me (v1.0.0) and they","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0"},"pb:consumer":{"title":"Consumer","name":"me","href":"http://pact.onegeek.com.au/pacticipants/me"},"pb:provider":{"title":"Provider","name":"they","href":"http://pact.onegeek.com.au/pacticipants/they"},"pb:latest-pact-version":{"title":"Pact","name":"Latest version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/latest"},"pb:previous-distinct":{"title":"Pact","name":"Previous distinct version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0/previous-distinct"},"pb:diff-previous-distinct":{"title":"Diff","name":"Diff with previous distinct version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0/diff/previous-distinct"},"pb:pact-webhooks":{"title":"Webhooks for the pact between me and they","href":"http://pact.onegeek.com.au/webhooks/provider/they/consumer/me"},"pb:tag-prod-version":{"title":"Tag this version as \'production\'","href":"http://pact.onegeek.com.au/pacticipants/me/versions/1.0.0/tags/prod"},"pb:tag-version":{"title":"Tag version","href":"http://pact.onegeek.com.au/pacticipants/me/versions/1.0.0/tags/{tag}"},"curies":[{"name":"pb","href":"http://pact.onegeek.com.au/doc/{rel}","templated":true}]}}'); | ||
res.json(obj); | ||
}); | ||
server.get('/pacts/provider/they/consumer/anotherclient/latest', auth, function (req, res) { | ||
var obj = JSON.parse('{"consumer":{"name":"anotherclient"},"provider":{"name":"they"},"interactions":[{"description":"Provider state success","provider_state":"There is a greeting","request":{"method":"GET","path":"/somestate"},"response":{"status":200,"headers":{},"body":{"greeting":"State data!"}}}],"metadata":{"pactSpecificationVersion":"2.0.0"},"updatedAt":"2016-05-15T00:09:33+00:00","createdAt":"2016-05-15T00:09:06+00:00","_links":{"self":{"title":"Pact","name":"Pact between me (v1.0.0) and they","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0"},"pb:consumer":{"title":"Consumer","name":"anotherclient","href":"http://pact.onegeek.com.au/pacticipants/me"},"pb:provider":{"title":"Provider","name":"they","href":"http://pact.onegeek.com.au/pacticipants/they"},"pb:latest-pact-version":{"title":"Pact","name":"Latest version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/latest"},"pb:previous-distinct":{"title":"Pact","name":"Previous distinct version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0/previous-distinct"},"pb:diff-previous-distinct":{"title":"Diff","name":"Diff with previous distinct version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0/diff/previous-distinct"},"pb:pact-webhooks":{"title":"Webhooks for the pact between me and they","href":"http://pact.onegeek.com.au/webhooks/provider/they/consumer/me"},"pb:tag-prod-version":{"title":"Tag this version as \'production\'","href":"http://pact.onegeek.com.au/pacticipants/me/versions/1.0.0/tags/prod"},"pb:tag-version":{"title":"Tag version","href":"http://pact.onegeek.com.au/pacticipants/me/versions/1.0.0/tags/{tag}"},"curies":[{"name":"pb","href":"http://pact.onegeek.com.au/doc/{rel}","templated":true}]}}'); | ||
res.json(obj); | ||
var obj = JSON.parse('{"consumer":{"name":"anotherclient"},"provider":{"name":"they"},"interactions":[{"description":"Provider state success","provider_state":"There is a greeting","request":{"method":"GET","path":"/somestate"},"response":{"status":200,"headers":{},"body":{"greeting":"State data!"}}}],"metadata":{"pactSpecificationVersion":"2.0.0"},"updatedAt":"2016-05-15T00:09:33+00:00","createdAt":"2016-05-15T00:09:06+00:00","_links":{"self":{"title":"Pact","name":"Pact between me (v1.0.0) and they","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0"},"pb:consumer":{"title":"Consumer","name":"anotherclient","href":"http://pact.onegeek.com.au/pacticipants/me"},"pb:provider":{"title":"Provider","name":"they","href":"http://pact.onegeek.com.au/pacticipants/they"},"pb:latest-pact-version":{"title":"Pact","name":"Latest version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/latest"},"pb:previous-distinct":{"title":"Pact","name":"Previous distinct version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0/previous-distinct"},"pb:diff-previous-distinct":{"title":"Diff","name":"Diff with previous distinct version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0/diff/previous-distinct"},"pb:pact-webhooks":{"title":"Webhooks for the pact between me and they","href":"http://pact.onegeek.com.au/webhooks/provider/they/consumer/me"},"pb:tag-prod-version":{"title":"Tag this version as \'production\'","href":"http://pact.onegeek.com.au/pacticipants/me/versions/1.0.0/tags/prod"},"pb:tag-version":{"title":"Tag version","href":"http://pact.onegeek.com.au/pacticipants/me/versions/1.0.0/tags/{tag}"},"curies":[{"name":"pb","href":"http://pact.onegeek.com.au/doc/{rel}","templated":true}]}}'); | ||
res.json(obj); | ||
}); | ||
server.get('/noauth/pacts/provider/they/consumer/me/latest', function (req, res) { | ||
var obj = JSON.parse('{"consumer":{"name":"me"},"provider":{"name":"they"},"interactions":[{"description":"Provider state success","provider_state":"There is a greeting","request":{"method":"GET","path":"/somestate"},"response":{"status":200,"headers":{},"body":{"greeting":"State data!"}}}],"metadata":{"pactSpecificationVersion":"2.0.0"},"updatedAt":"2016-05-15T00:09:33+00:00","createdAt":"2016-05-15T00:09:06+00:00","_links":{"self":{"title":"Pact","name":"Pact between me (v1.0.0) and they","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0"},"pb:consumer":{"title":"Consumer","name":"me","href":"http://pact.onegeek.com.au/pacticipants/me"},"pb:provider":{"title":"Provider","name":"they","href":"http://pact.onegeek.com.au/pacticipants/they"},"pb:latest-pact-version":{"title":"Pact","name":"Latest version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/latest"},"pb:previous-distinct":{"title":"Pact","name":"Previous distinct version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0/previous-distinct"},"pb:diff-previous-distinct":{"title":"Diff","name":"Diff with previous distinct version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0/diff/previous-distinct"},"pb:pact-webhooks":{"title":"Webhooks for the pact between me and they","href":"http://pact.onegeek.com.au/webhooks/provider/they/consumer/me"},"pb:tag-prod-version":{"title":"Tag this version as \'production\'","href":"http://pact.onegeek.com.au/pacticipants/me/versions/1.0.0/tags/prod"},"pb:tag-version":{"title":"Tag version","href":"http://pact.onegeek.com.au/pacticipants/me/versions/1.0.0/tags/{tag}"},"curies":[{"name":"pb","href":"http://pact.onegeek.com.au/doc/{rel}","templated":true}]}}'); | ||
res.json(obj); | ||
var obj = JSON.parse('{"consumer":{"name":"me"},"provider":{"name":"they"},"interactions":[{"description":"Provider state success","provider_state":"There is a greeting","request":{"method":"GET","path":"/somestate"},"response":{"status":200,"headers":{},"body":{"greeting":"State data!"}}}],"metadata":{"pactSpecificationVersion":"2.0.0"},"updatedAt":"2016-05-15T00:09:33+00:00","createdAt":"2016-05-15T00:09:06+00:00","_links":{"self":{"title":"Pact","name":"Pact between me (v1.0.0) and they","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0"},"pb:consumer":{"title":"Consumer","name":"me","href":"http://pact.onegeek.com.au/pacticipants/me"},"pb:provider":{"title":"Provider","name":"they","href":"http://pact.onegeek.com.au/pacticipants/they"},"pb:latest-pact-version":{"title":"Pact","name":"Latest version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/latest"},"pb:previous-distinct":{"title":"Pact","name":"Previous distinct version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0/previous-distinct"},"pb:diff-previous-distinct":{"title":"Diff","name":"Diff with previous distinct version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0/diff/previous-distinct"},"pb:pact-webhooks":{"title":"Webhooks for the pact between me and they","href":"http://pact.onegeek.com.au/webhooks/provider/they/consumer/me"},"pb:tag-prod-version":{"title":"Tag this version as \'production\'","href":"http://pact.onegeek.com.au/pacticipants/me/versions/1.0.0/tags/prod"},"pb:tag-version":{"title":"Tag version","href":"http://pact.onegeek.com.au/pacticipants/me/versions/1.0.0/tags/{tag}"},"curies":[{"name":"pb","href":"http://pact.onegeek.com.au/doc/{rel}","templated":true}]}}'); | ||
res.json(obj); | ||
}); | ||
server.get('/noauth/pacts/provider/they/consumer/anotherclient/latest', function (req, res) { | ||
var obj = JSON.parse('{"consumer":{"name":"anotherclient"},"provider":{"name":"they"},"interactions":[{"description":"Provider state success","provider_state":"There is a greeting","request":{"method":"GET","path":"/somestate"},"response":{"status":200,"headers":{},"body":{"greeting":"State data!"}}}],"metadata":{"pactSpecificationVersion":"2.0.0"},"updatedAt":"2016-05-15T00:09:33+00:00","createdAt":"2016-05-15T00:09:06+00:00","_links":{"self":{"title":"Pact","name":"Pact between me (v1.0.0) and they","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0"},"pb:consumer":{"title":"Consumer","name":"anotherclient","href":"http://pact.onegeek.com.au/pacticipants/me"},"pb:provider":{"title":"Provider","name":"they","href":"http://pact.onegeek.com.au/pacticipants/they"},"pb:latest-pact-version":{"title":"Pact","name":"Latest version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/latest"},"pb:previous-distinct":{"title":"Pact","name":"Previous distinct version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0/previous-distinct"},"pb:diff-previous-distinct":{"title":"Diff","name":"Diff with previous distinct version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0/diff/previous-distinct"},"pb:pact-webhooks":{"title":"Webhooks for the pact between me and they","href":"http://pact.onegeek.com.au/webhooks/provider/they/consumer/me"},"pb:tag-prod-version":{"title":"Tag this version as \'production\'","href":"http://pact.onegeek.com.au/pacticipants/me/versions/1.0.0/tags/prod"},"pb:tag-version":{"title":"Tag version","href":"http://pact.onegeek.com.au/pacticipants/me/versions/1.0.0/tags/{tag}"},"curies":[{"name":"pb","href":"http://pact.onegeek.com.au/doc/{rel}","templated":true}]}}'); | ||
res.json(obj); | ||
var obj = JSON.parse('{"consumer":{"name":"anotherclient"},"provider":{"name":"they"},"interactions":[{"description":"Provider state success","provider_state":"There is a greeting","request":{"method":"GET","path":"/somestate"},"response":{"status":200,"headers":{},"body":{"greeting":"State data!"}}}],"metadata":{"pactSpecificationVersion":"2.0.0"},"updatedAt":"2016-05-15T00:09:33+00:00","createdAt":"2016-05-15T00:09:06+00:00","_links":{"self":{"title":"Pact","name":"Pact between me (v1.0.0) and they","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0"},"pb:consumer":{"title":"Consumer","name":"anotherclient","href":"http://pact.onegeek.com.au/pacticipants/me"},"pb:provider":{"title":"Provider","name":"they","href":"http://pact.onegeek.com.au/pacticipants/they"},"pb:latest-pact-version":{"title":"Pact","name":"Latest version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/latest"},"pb:previous-distinct":{"title":"Pact","name":"Previous distinct version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0/previous-distinct"},"pb:diff-previous-distinct":{"title":"Diff","name":"Diff with previous distinct version of this pact","href":"http://pact.onegeek.com.au/pacts/provider/they/consumer/me/version/1.0.0/diff/previous-distinct"},"pb:pact-webhooks":{"title":"Webhooks for the pact between me and they","href":"http://pact.onegeek.com.au/webhooks/provider/they/consumer/me"},"pb:tag-prod-version":{"title":"Tag this version as \'production\'","href":"http://pact.onegeek.com.au/pacticipants/me/versions/1.0.0/tags/prod"},"pb:tag-version":{"title":"Tag version","href":"http://pact.onegeek.com.au/pacticipants/me/versions/1.0.0/tags/{tag}"},"curies":[{"name":"pb","href":"http://pact.onegeek.com.au/doc/{rel}","templated":true}]}}'); | ||
res.json(obj); | ||
}); | ||
module.exports = server | ||
module.exports = server; |
84334
2008
21
13
20
+ Addedunixify@^0.2.1
+ Added@pact-foundation/pact-provider-verifier@0.0.12(transitive)
+ Added@pact-foundation/pact-provider-verifier-darwin@0.0.12(transitive)
+ Added@pact-foundation/pact-provider-verifier-linux-ia32@0.0.12(transitive)
+ Added@pact-foundation/pact-provider-verifier-linux-x64@0.0.12(transitive)
+ Added@pact-foundation/pact-provider-verifier-win32@0.0.12(transitive)
+ Addednormalize-path@2.1.1(transitive)
+ Addedremove-trailing-separator@1.1.0(transitive)
+ Addedunixify@0.2.1(transitive)
- Removed@pact-foundation/pact-provider-verifier@0.0.6(transitive)
- Removed@pact-foundation/pact-provider-verifier-darwin@0.0.6(transitive)
- Removed@pact-foundation/pact-provider-verifier-linux-ia32@0.0.6(transitive)
- Removed@pact-foundation/pact-provider-verifier-linux-x64@0.0.6(transitive)
- Removed@pact-foundation/pact-provider-verifier-win32@0.0.6(transitive)