{"_id":"shmock","_rev":"27-fc739af1c0e8db3034bce6feefd2dab3","name":"shmock","description":"Simple HTTP Mocking library","dist-tags":{"latest":"0.8.1"},"versions":{"0.0.1":{"name":"shmock","version":"0.0.1","description":"Simple HTTP Mocking library","keywords":["express","http","test","mock"],"dependencies":{"express":"~3.4.8","methods":"~0.1.0","should":"~1.2.2"},"devDependencies":{"mocha":"~1.12.0","request":"~2.27.0","supertest":"~0.9.0"},"scripts":{"test":"make test"},"license":"MIT","repository":{"type":"git","url":"https://github.com/xetorthio/shmock.git"},"bugs":{"url":"https://github.com/xetorthio/shmock/issues"},"homepage":"https://github.com/xetorthio/shmock","_id":"shmock@0.0.1","dist":{"shasum":"46b08d1e7a4d93ef721ed477f92e243abf082608","tarball":"https://registry.npmjs.org/shmock/-/shmock-0.0.1.tgz","integrity":"sha512-abFyBKcZKUFWZw7o2U2d5HB2mGPFVV6AuZ3ozXJYecWK4kNRczcSA2jqyPAqMPZZtih8RDJLEDU3aej1MLXDXQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCEtI2Xe2sJEFJ1CJmCPcb/u/ZA7GPQ4FBZOL8ankL/pQIhAIgdVvskl9qpOe6adoySecUhXmx5IDlVGnBZYvEpuXQ4"}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"xetorthio","email":"ionathan@gmail.com"},"maintainers":[{"name":"xetorthio","email":"ionathan@gmail.com"}]},"0.1.0":{"name":"shmock","version":"0.1.0","description":"Simple HTTP Mocking library","keywords":["express","http","test","mock"],"dependencies":{"express":"~3.4.8","methods":"~0.1.0","should":"~1.2.2"},"devDependencies":{"mocha":"~1.12.0","request":"~2.27.0","supertest":"~0.9.0"},"scripts":{"test":"make test"},"license":"MIT","repository":{"type":"git","url":"https://github.com/xetorthio/shmock.git"},"bugs":{"url":"https://github.com/xetorthio/shmock/issues"},"homepage":"https://github.com/xetorthio/shmock","_id":"shmock@0.1.0","dist":{"shasum":"d15d408e5ead73a09a3241fd97292044e79ee360","tarball":"https://registry.npmjs.org/shmock/-/shmock-0.1.0.tgz","integrity":"sha512-LmCToqT1sDiLw1rJ0u+IvDSeYrDzywZud38ALsLNr1YyN30AjVnc/HdxojuoE3CLfRHNNdkitXBSHcERUVL2bw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDfiEQILrQMEmHYTc43AXg40+8UHm+sPKOeGJf9PioHXQIhAJUbi+wSAJMRmQ3MnGiqtMdt4zUVCVPwZvgbTynNMu7T"}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"xetorthio","email":"ionathan@gmail.com"},"maintainers":[{"name":"xetorthio","email":"ionathan@gmail.com"}]},"0.2.0":{"name":"shmock","version":"0.2.0","description":"Simple HTTP Mocking library","keywords":["express","http","test","mock"],"dependencies":{"express":"~3.4.8","methods":"~0.1.0","should":"~1.2.2"},"devDependencies":{"mocha":"~1.12.0","request":"~2.27.0","supertest":"~0.9.0"},"scripts":{"test":"make test"},"license":"MIT","repository":{"type":"git","url":"https://github.com/xetorthio/shmock.git"},"bugs":{"url":"https://github.com/xetorthio/shmock/issues"},"homepage":"https://github.com/xetorthio/shmock","_id":"shmock@0.2.0","dist":{"shasum":"28f68237a0ca4166b8f7cc5f4f25a3d7be1b5539","tarball":"https://registry.npmjs.org/shmock/-/shmock-0.2.0.tgz","integrity":"sha512-3Za4Eyd3CoE9YaMoUqRLnbi1EU0w5g3sD6xj0OQ8rPjbS3HkYaBFWTDVoH4UFcyudEQZBOy6jKdyCR6hGvlgKA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFcXrJQvUkfdZQ2NBIxfcVes3oKbCttvORqC4ylB8vPzAiEA2L4/Lv4VjqJak5owzTgTT1qVZi+osXTBBFIKiJsBbeA="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"xetorthio","email":"ionathan@gmail.com"},"maintainers":[{"name":"xetorthio","email":"ionathan@gmail.com"}]},"0.3.0":{"name":"shmock","version":"0.3.0","description":"Simple HTTP Mocking library","keywords":["express","http","test","mock"],"dependencies":{"express":"~3.4.8","methods":"~0.1.0","should":"~1.2.2"},"devDependencies":{"mocha":"~1.12.0","request":"~2.27.0","supertest":"~0.9.0"},"scripts":{"test":"make test"},"license":"MIT","repository":{"type":"git","url":"https://github.com/xetorthio/shmock.git"},"bugs":{"url":"https://github.com/xetorthio/shmock/issues"},"homepage":"https://github.com/xetorthio/shmock","_id":"shmock@0.3.0","dist":{"shasum":"78d7b723867e353687192b3776857d7e31f4f1e0","tarball":"https://registry.npmjs.org/shmock/-/shmock-0.3.0.tgz","integrity":"sha512-nUXzzTCZS3L8SKWyDZycE56OV5CMCH3izO7G9GRPm23UwwQ4MHEgH7duu6Ea+USp5I3xt4ggxkUtuv6yBh+5QA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDAUGvl/Y5/4d9NUOGvQ419uY1GIAu3spfh3AgrkdGzPAIgRTmD8NJrl3OPhDyyj/b7He8YV25LbxeG9Z4HZrQkbQo="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"xetorthio","email":"ionathan@gmail.com"},"maintainers":[{"name":"xetorthio","email":"ionathan@gmail.com"}]},"0.3.1":{"name":"shmock","version":"0.3.1","description":"Simple HTTP Mocking library","keywords":["express","http","test","mock"],"dependencies":{"express":"~3.4.8","methods":"~0.1.0","should":"~1.2.2"},"devDependencies":{"mocha":"~1.12.0","request":"~2.27.0","supertest":"~0.9.0"},"scripts":{"test":"make test"},"license":"MIT","repository":{"type":"git","url":"https://github.com/xetorthio/shmock.git"},"bugs":{"url":"https://github.com/xetorthio/shmock/issues"},"homepage":"https://github.com/xetorthio/shmock","_id":"shmock@0.3.1","dist":{"shasum":"193f6448dc18f11eae9e414181532e4a4202c727","tarball":"https://registry.npmjs.org/shmock/-/shmock-0.3.1.tgz","integrity":"sha512-ltM5iwSSj+rYAg49OiZz2gU8DA7qCZDoFgVWXTeeJEJ6/y96mQsHzoiSi8Nqoxkv5iaOSp5HdAMzYuF+i3uFEA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD+uK9xx6Zgs3LQYFTHSue8C+fwqmIgQq1Wha6JWijyVwIgBGLo8bAs+OLeSzbYc6b2L2B31Db7B9/5k0Oim4We2SQ="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"xetorthio","email":"ionathan@gmail.com"},"maintainers":[{"name":"xetorthio","email":"ionathan@gmail.com"}]},"0.4.0":{"name":"shmock","version":"0.4.0","description":"Simple HTTP Mocking library","keywords":["express","http","test","mock"],"dependencies":{"express":"~3.4.8","methods":"~0.1.0","should":"~1.2.2"},"devDependencies":{"mocha":"~1.12.0","request":"~2.27.0","supertest":"~0.9.0"},"scripts":{"test":"make test"},"license":"MIT","repository":{"type":"git","url":"https://github.com/xetorthio/shmock.git"},"bugs":{"url":"https://github.com/xetorthio/shmock/issues"},"homepage":"https://github.com/xetorthio/shmock","_id":"shmock@0.4.0","dist":{"shasum":"bde5aee3c3db0edce67983078b2a5740a1c55241","tarball":"https://registry.npmjs.org/shmock/-/shmock-0.4.0.tgz","integrity":"sha512-JI2WyYim1/p0nEqJbbIQeORul0ru18GLzKYCHscKZR2/62HOo0QvXu3x9eZk7gXah0poRiM2XQEtWTHaI2EaWg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEeqweNrXp1TebCmmp68glADhKcfa2HfCYKvP7JiaPMYAiEAnmdl2lNUzS0BrBlbPMYpaCYWKOCCKpFVaLbNCEtAu4M="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"xetorthio","email":"ionathan@gmail.com"},"maintainers":[{"name":"xetorthio","email":"ionathan@gmail.com"}]},"0.4.1":{"name":"shmock","version":"0.4.1","description":"Simple HTTP Mocking library","keywords":["express","http","test","mock"],"dependencies":{"express":"~3.4.8","methods":"~0.1.0","should":"~1.2.2"},"devDependencies":{"mocha":"~1.12.0","request":"~2.27.0","supertest":"~0.9.0"},"scripts":{"test":"make test"},"license":"MIT","repository":{"type":"git","url":"https://github.com/xetorthio/shmock.git"},"bugs":{"url":"https://github.com/xetorthio/shmock/issues"},"homepage":"https://github.com/xetorthio/shmock","_id":"shmock@0.4.1","dist":{"shasum":"9a78d99094f79545bf7a6ebb32d04ecc893cd18c","tarball":"https://registry.npmjs.org/shmock/-/shmock-0.4.1.tgz","integrity":"sha512-Eu0GovlsSq6vIvOZtvFLf3QMWgAI/7p4uk7PoAwO8RM00PKkYAhCM2QqXtQ07y8f/4rdyEcZrYFgwwrxdM4jug==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDGmVa7BVedacHHuEpWX7lJBhy9IXa392lsrDlbvS7WHAIgGjvUThqseQAYKC+aM/n5yN/cNjOK8Oem7NPTiXIkPK0="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"xetorthio","email":"ionathan@gmail.com"},"maintainers":[{"name":"xetorthio","email":"ionathan@gmail.com"}]},"0.5.0":{"name":"shmock","version":"0.5.0","description":"Simple HTTP Mocking library","keywords":["express","http","test","mock"],"dependencies":{"express":"~3.4.8","methods":"~0.1.0","should":"~1.2.2"},"devDependencies":{"mocha":"~1.12.0","request":"~2.27.0","supertest":"~0.9.0"},"scripts":{"test":"make test"},"license":"MIT","repository":{"type":"git","url":"https://github.com/xetorthio/shmock.git"},"bugs":{"url":"https://github.com/xetorthio/shmock/issues"},"homepage":"https://github.com/xetorthio/shmock","_id":"shmock@0.5.0","dist":{"shasum":"00e9e4f70fa285125e590430659ef5c48747b1c7","tarball":"https://registry.npmjs.org/shmock/-/shmock-0.5.0.tgz","integrity":"sha512-QOPyN2kGkZfDX9efM8/Gqg5zVrmQCmYGnI5P92afthGXUEHTophOcFP+VQ7SZeQ6QIkBeUVnSckBj9bjlivpzg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDC84gNGIY8B1rboWjQaJO1eQWi5tRDPPidbMq+jqQO3wIgJneNUOWMgNMcwR9FfUabmR9XJr0kxr3poTrsspn00C8="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"xetorthio","email":"ionathan@gmail.com"},"maintainers":[{"name":"xetorthio","email":"ionathan@gmail.com"}]},"0.6.0":{"name":"shmock","version":"0.6.0","description":"Simple HTTP Mocking library","keywords":["express","http","test","mock"],"dependencies":{"express":"~3.4.8","methods":"~0.1.0","should":"~1.2.2"},"devDependencies":{"mocha":"~1.12.0","request":"~2.27.0","supertest":"~0.9.0"},"scripts":{"test":"make test"},"license":"MIT","repository":{"type":"git","url":"https://github.com/xetorthio/shmock.git"},"bugs":{"url":"https://github.com/xetorthio/shmock/issues"},"homepage":"https://github.com/xetorthio/shmock","_id":"shmock@0.6.0","dist":{"shasum":"fcc69e8f2542fea93e8fd3bc8cc12daf84ee1355","tarball":"https://registry.npmjs.org/shmock/-/shmock-0.6.0.tgz","integrity":"sha512-WmyLIAz96NfaVYLtwFtXxqhT11EwZSYPkosqmw23GLosGF3f2mIlL0bPQ2aAGjLd5OqZLLg+sJVvb0DrssvrZg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCaBtsryt+8nmvEpZRsMnlsTv/3EMO5kvTxMwQBPPSk+gIgTGs5VpttpYieWn9PTrlicJG5m+TvX6ftCjGs0S+q3V4="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"xetorthio","email":"ionathan@gmail.com"},"maintainers":[{"name":"xetorthio","email":"ionathan@gmail.com"}]},"0.7.0":{"name":"shmock","version":"0.7.0","description":"Simple HTTP Mocking library","keywords":["express","http","test","mock"],"dependencies":{"express":"~3.4.8","methods":"~0.1.0","should":"~1.2.2"},"devDependencies":{"mocha":"~1.12.0","request":"~2.27.0","supertest":"~0.9.0"},"scripts":{"test":"make test"},"license":"MIT","repository":{"type":"git","url":"https://github.com/xetorthio/shmock.git"},"bugs":{"url":"https://github.com/xetorthio/shmock/issues"},"homepage":"https://github.com/xetorthio/shmock","_id":"shmock@0.7.0","_shasum":"ebfe0da982edcebdfcbe23ff4aeb8495e880a773","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"xetorthio","email":"ionathan@gmail.com"},"maintainers":[{"name":"xetorthio","email":"ionathan@gmail.com"}],"dist":{"shasum":"ebfe0da982edcebdfcbe23ff4aeb8495e880a773","tarball":"https://registry.npmjs.org/shmock/-/shmock-0.7.0.tgz","integrity":"sha512-DVv3lrAY+ht/WY4FlQXWQYMTHR+60nMXXyxTfK8Sn8RSB/Qhk2pXfJ9QK2UfYkOdDN8V03R5SM+JfNR8r7F4Bw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD+IxVDdtQkC22rPfipE+CehSd6g/cfZO1cyrdCUNdJdAIgaf84uJDuc6j/SUDFjCzUZHD2HmSNhlVsDwv8N9dH9PI="}]}},"0.7.1":{"name":"shmock","version":"0.7.1","description":"Simple HTTP Mocking library","keywords":["express","http","test","mock"],"dependencies":{"express":"~3.4.8","methods":"~0.1.0"},"devDependencies":{"mocha":"~1.12.0","request":"~2.27.0","supertest":"~0.9.0","should":"~1.2.2"},"scripts":{"test":"make test"},"license":"MIT","repository":{"type":"git","url":"https://github.com/xetorthio/shmock.git"},"bugs":{"url":"https://github.com/xetorthio/shmock/issues"},"homepage":"https://github.com/xetorthio/shmock","_id":"shmock@0.7.1","_shasum":"45589d43b9ca88708b0d79a64e460651b910fca7","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"xetorthio","email":"ionathan@gmail.com"},"maintainers":[{"name":"xetorthio","email":"ionathan@gmail.com"}],"dist":{"shasum":"45589d43b9ca88708b0d79a64e460651b910fca7","tarball":"https://registry.npmjs.org/shmock/-/shmock-0.7.1.tgz","integrity":"sha512-FtOIjAe9bK6U2I0Z0A8gERQ4xpSklIhvL7X81DSrQ8VsPYTi09oorzEWTceT/kNr6dih0rmBoNgU9AcUBHIjEg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDndBmBKh4UYk9ZWlwaS0XLc6zRjCKT2qUFi5EkZxfafgIgQqRbqMcJlEnIqApLmtH/hG+1fX5HoiMA4xVIfYnZI5c="}]}},"0.7.2":{"name":"shmock","version":"0.7.2","description":"Simple HTTP Mocking library","keywords":["express","http","test","mock"],"dependencies":{"express":"~3.4.8","methods":"~0.1.0"},"devDependencies":{"mocha":"~1.12.0","request":"~2.27.0","supertest":"~0.9.0","should":"~1.2.2"},"scripts":{"test":"make test"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/xetorthio/shmock.git"},"bugs":{"url":"https://github.com/xetorthio/shmock/issues"},"homepage":"https://github.com/xetorthio/shmock","gitHead":"8acd2e5201c6f83568c00226fda498eb2a1d726c","_id":"shmock@0.7.2","_shasum":"a2ec9fcf11fe2af40f96e2e64913e6142795ef06","_from":".","_npmVersion":"2.13.3","_nodeVersion":"3.1.0","_npmUser":{"name":"xetorthio","email":"ionathan@gmail.com"},"dist":{"shasum":"a2ec9fcf11fe2af40f96e2e64913e6142795ef06","tarball":"https://registry.npmjs.org/shmock/-/shmock-0.7.2.tgz","integrity":"sha512-w3mQslzWS230A+sX7Qdm2AZu39ScU/1eXZ6oQ2Nd7nVzP3HzQLdHXieyoSaDfCSf77+6+qYNr++bWaiiIh2Otw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDGdjdqGFzEkGGZqOKz4+nOuvi57QWNGRVMl0HlMdrwKQIhAPWr1ejlDoGUkqAk66Lg/Iu4mjRlvlixaJxyOR5wcU/q"}]},"maintainers":[{"name":"xetorthio","email":"ionathan@gmail.com"}]},"0.8.0":{"name":"shmock","version":"0.8.0","description":"Simple HTTP Mocking library","keywords":["express","http","test","mock"],"dependencies":{"assert-diff":"^1.0.1","express":"~3.4.8","methods":"~0.1.0"},"devDependencies":{"mocha":"~1.12.0","request":"~2.27.0","supertest":"~0.9.0","should":"~1.2.2"},"scripts":{"test":"make test"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/xetorthio/shmock.git"},"bugs":{"url":"https://github.com/xetorthio/shmock/issues"},"homepage":"https://github.com/xetorthio/shmock","gitHead":"9c961076b1cfe09d13963ea4bed493b2b327bc2e","_id":"shmock@0.8.0","_shasum":"00631f21b811dbbcd71d878314d91650f751ad74","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.1","_npmUser":{"name":"xetorthio","email":"ionathan@gmail.com"},"dist":{"shasum":"00631f21b811dbbcd71d878314d91650f751ad74","tarball":"https://registry.npmjs.org/shmock/-/shmock-0.8.0.tgz","integrity":"sha512-KyYxHrELloHSIzctLMATL4Gk7wiJ0POXY4/dQKRBXBkHiMM4MTXoKtpAf8uAh4+j/lEH4jGmrCyuTtyBRy6KVw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGJY78FkUXMzaN5E5AZ4NSbSoENT1/XYn31tRZs84T2FAiEA24bCzMmaWpt5zQQ1Dvvt7dNnlDGH4dQRy3MG/bFQO6k="}]},"maintainers":[{"name":"xetorthio","email":"ionathan@gmail.com"}]},"0.8.1":{"name":"shmock","version":"0.8.1","description":"Simple HTTP Mocking library","keywords":["express","http","test","mock"],"dependencies":{"assert-diff":"^1.0.1","express":"~3.4.8","methods":"~0.1.0"},"devDependencies":{"mocha":"~1.12.0","request":"~2.27.0","supertest":"~0.9.0","should":"~1.2.2"},"scripts":{"test":"make test"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/xetorthio/shmock.git"},"bugs":{"url":"https://github.com/xetorthio/shmock/issues"},"homepage":"https://github.com/xetorthio/shmock","gitHead":"12929e1915584426450f7e97054334cf92cb47fd","_id":"shmock@0.8.1","_shasum":"210ed02c167d2306f5db8d698ed43a44a5eeae90","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.1","_npmUser":{"name":"xetorthio","email":"ionathan@gmail.com"},"dist":{"shasum":"210ed02c167d2306f5db8d698ed43a44a5eeae90","tarball":"https://registry.npmjs.org/shmock/-/shmock-0.8.1.tgz","integrity":"sha512-CrzRLrod3pSK6X8KeUNYyub4265RkRrV6p0NeDDPZvTKC6tklRc7jFaJHOnEASzBD07yfpYpfg9ErsPvI66KEQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH5mTBf/so2LhiOchuT+Dax5Wrtb0PlQFM0QFeOHQT25AiAKp6pJ6pxQNZQdhO8Q2ysKFJ4+gqbGLCSn0aDgt3N5Jw=="}]},"maintainers":[{"name":"xetorthio","email":"ionathan@gmail.com"}]}},"readme":"# Shmock\n\n  [![Build Status](https://travis-ci.org/xetorthio/shmock.png)](https://travis-ci.org/xetorthio/shmock)\n\n  [Express](https://github.com/visionmedia/express) based http mocking library.\n\n  The reason for this to exist is because I believe that mocking functions to change their behavior is extremely horrible and prone to errors. Libraries like [nock](https://github.com/pgte/nock) take this approach, and then there are a few cases where thing doesn't work. Maybe because of how http clients work, etc.\n\n  So this library provides a super nice API, like the one of [superagent](https://github.com/visionmedia/superagent) but it creates a real http server (using [express](https://github.com/visionmedia/express)). The nice thing about this is that you don't really care about the implementation, which http client is being used, or even if nodes native http api changes.\n\n  Make sure to view the test for [examples](https://github.com/xetorthio/shmock/tree/master/test/shmock.js).\n\n## Installation\n\n```\n$ npm install shmock\n```\n\n## Usage\n\n### Initialize with or without port\n\n```js\nvar shmock = require('shmock');\n\nvar mock = shmock(); // will give some arbitrary port\n\nvar mock2 = shmock(9000); // will use port 9000\n```\n\n### Define expectations\n\n\n#### On http methods\n\n```js\nmock.get(\"/foo\").reply(200, \"bar\");\n```\n\n#### On http headers\n\n```js\nmock.get(\"/foo\").set(\"Authorization\", \"123456\").reply(200, \"bar\");\n```\n\n#### Specifying response headers\n\n```js\nmock.get(\"/foo\").set(\"Authorization\", \"123456\").reply(200, \"bar\", {\"X-my-header\", \"My header value\"});\n```\n\n#### On querystring parameters\n\n```js\nmock.get(\"/foo\").query(\"a=bi&c=d\").reply(200, \"bar\");\nmock.get(\"/foo\").query({a: \"b\", c: \"d\"}).reply(200, \"bar\");\n```\n\n#### On request body\n\n```js\nmock.post(\"/foo\").send({a: \"b\"}).reply(200, \"bar\");\nmock.post(\"/foo\").send(\"123456\").reply(200, \"bar\");\n```\n\n#### Add a delay to the reply\n```js\nmock.get(\"/foo\").delay(500).reply(200);\n```\n\n### Make assertions on the handler\n\n#### Check if expectation has been met\n\n```js\nvar handler = mock.get(\"/foo\").reply(200);\n...\n...\nhandler.isDone.should.be.ok;\nhandler.done(); // Throws an error if isDone is false\n```\n\n#### Wait for expectation to be met\n```js\nvar handler = mock.get(\"/foo\").reply(200);\n...\n...\nhandler.wait(function(err) {\n  if(err) {\n    // A default timeout of 2 seconds has passed and still the expectation hasn't been bet\n  }\n});\n```\n\nYou can also specify a timeout in ms:\n```js\nhandler.wait(200, function(err) { ... });\n```\nOr if using mocha:\n```js\nhandler.wait(200, done);\n```\n\n### Custom middleware\nCustom middlewares can be injected into the Express stack in order to perform arbitrary manipulations on mock requests, for instance:\n\n```javascript\nvar shmock = shmock(9100, [function(req, res, next) {\n  // do something with req/res then call next\n  next();\n}, function(req, res, next) {\n  // do something else with the request object\n  next()\n}]);\n```\n\nAs you would expect the arguments are the default arguments passed to request middleware by Express, so in order they are: `req` (the request object); `res` (the response object); and `done` (the callback).\n\n## License\n\n  MIT\n\n","maintainers":[{"name":"xetorthio","email":"ionathan@gmail.com"}],"time":{"modified":"2022-06-26T18:58:54.155Z","created":"2014-02-21T22:40:01.972Z","0.0.1":"2014-02-21T22:40:01.972Z","0.1.0":"2014-02-21T22:53:40.164Z","0.2.0":"2014-02-22T03:30:36.592Z","0.3.0":"2014-02-24T15:56:17.197Z","0.3.1":"2014-02-24T16:44:27.123Z","0.4.0":"2014-02-24T17:10:22.606Z","0.4.1":"2014-02-24T19:19:02.770Z","0.5.0":"2014-02-25T20:52:16.724Z","0.6.0":"2014-02-27T16:52:47.598Z","0.7.0":"2014-05-22T21:23:36.259Z","0.7.1":"2014-07-17T16:10:07.026Z","0.7.2":"2015-09-07T21:29:21.698Z","0.8.0":"2016-01-19T21:08:32.061Z","0.8.1":"2016-01-19T21:18:25.516Z"},"readmeFilename":"README.md","homepage":"https://github.com/xetorthio/shmock","keywords":["express","http","test","mock"],"repository":{"type":"git","url":"git+https://github.com/xetorthio/shmock.git"},"bugs":{"url":"https://github.com/xetorthio/shmock/issues"},"license":"MIT"}