{"_id":"@mmb-digital/mockserver","_rev":"26-b0de8577161ff9b2d026e110cec81fd4","name":"@mmb-digital/mockserver","dist-tags":{"latest":"1.4.6"},"versions":{"1.3.0":{"name":"@mmb-digital/mockserver","version":"1.3.0","keywords":["test","mock","api","webservice","rest","namshi"],"author":{"name":"Mohammad Hallal","email":"mohd.hallal@gmail.com"},"license":"MIT","_id":"@mmb-digital/mockserver@1.3.0","maintainers":[{"name":"roman.polansky","email":"roman.polansky@moneta.cz"},{"name":"jerryna","email":"jonas.vaclavek@moneta.cz"},{"name":"machy","email":"jiri@machacek.pro"},{"name":"roman.hala","email":"halaroman1@gmail.com"},{"name":"maros.vranec","email":"maros.vranec@gmail.com"},{"name":"jiri.frank.88","email":"info@jirifrank.eu"},{"name":"josefzamrzla","email":"josef.zamrzla@gmail.com"},{"name":"michal.sida","email":"michal.sida@gmail.com"},{"name":"kakin","email":"tomas.kakin@gmail.com"}],"homepage":"https://bitbucket/projects/REACT/repos/mockserver","bin":{"mockserver":"bin/mockserver.js"},"dist":{"shasum":"85db675347421153a410f26fa104faad68406750","tarball":"https://registry.npmjs.org/@mmb-digital/mockserver/-/mockserver-1.3.0.tgz","fileCount":42,"integrity":"sha512-vpwQTFA3UcQ26kTylafCTqWxFDT7faoN0A2CkSw5B0Ag9sTCCkqA/8gys4DAkF+oLdkSQwPH+Z4PwAO5Ql3jKg==","signatures":[{"sig":"MEUCIAwVWeeEWRIjYP1L9pezePNfgm1xdvyUysooYtZlwxzbAiEAy9AU4+uVKqL9rAnQYVS8/BwLrNjMB5+RiIYiPa+ICGM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":33109,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh7n7uCRA9TVsSAnZWagAAkRkP/jaxU4m30aa1+zF20j7r\nE2R4mA7QCx2xZW7qkNQycZqvP+LuW62iy+2Kbz4pSlId4LCj7r146y0FwXS2\nWxB8V6sECd8UPxFRIDb2EBvKM1T9YST+CL8YQvGLja6VAphquF+0/YoolWkF\n31rc7oOalCQGv9Lm72KdVRIlOWEo1xW04UlzXz2zGdCSBoS3Q05acwI4Hzx0\nOI9NAUDBeyxiouqssrZS3lrupuh+9I/d94fK4HLNdbo6/einnZqjLmzn+Ph3\n/Ows65LqhXCDrtOFRdplzNwBZ7cTUy4UAZ6X/9TNZhfsXVcNypaan+tP59pn\nLBIT8HlhguieBd5oFKl+iyCMT6Boj6mvwtbsMMWHghQHOxFNb4Nm9XYp/gJ/\n2hvf7b6o3SdoK/rKrLACWlZT8gDJfsD1KTARI/dzzdMvfDL6Ws1CW2q5mdaH\nWOjvAYCbBiJgcLModN5xFJero35sv3aTskyTLJstoG30/8FrR0yLapyZFVg9\nwbNvlhIzWS3/PIaoL7zqjur961kTvOh6aRTOqvPQs4v8lWRqApd66wau6ba5\nV/JKow60skvkfYk1BV0+tGy9VWYjuVBui1vRgjRTNTy70wakHwZUdd7fKwlV\nYLiqbTClRwRGZZ+UyXnHTvcvTsJotrR1I6xtlw9C5EWfY6bT/6yFFjepD+0f\njykZ\r\n=cge8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"mockserver.js","scripts":{"test":"mocha -b"},"_npmUser":{"name":"machy","email":"jiri@machacek.pro"},"repository":{"url":"https://bitbucket/projects/REACT/repos/mockserver","type":"git"},"description":"Easily mock your webservices while testing frontends.","directories":{},"dependencies":{"yargs":"^1.3.3","colors":"^1.0.3","query-string":"^6.13.5","js-combinatorics":"^0.4.0"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^2.0.1","mock-req":"^0.2.0"},"_npmOperationalInternal":{"tmp":"tmp/mockserver_1.3.0_1643020013897_0.5196918749295494","host":"s3://npm-registry-packages"}},"1.4.4":{"name":"@mmb-digital/mockserver","version":"1.4.4","keywords":["test","mock","api","webservice","rest","namshi"],"author":{"name":"Mohammad Hallal","email":"mohd.hallal@gmail.com"},"license":"MIT","_id":"@mmb-digital/mockserver@1.4.4","maintainers":[{"name":"josefzamrzla","email":"josef.zamrzla@gmail.com"},{"name":"janprasil","email":"prasil.honza@gmail.com"},{"name":"roman.polansky","email":"roman.polansky@moneta.cz"},{"name":"honzadanhel","email":"jjoohhhnnyy@gmail.com"},{"name":"lukasvitek.cz","email":"kontakt@lukasvitek.cz"},{"name":"janacek80","email":"janacek@centrum.cz"},{"name":"martin.jirak","email":"martin.jirak@moneta.cz"},{"name":"novotnydaniel","email":"novotny.daniel@outlook.com"},{"name":"wafflepie","email":"vaclav.janc@gmail.com"},{"name":"yersain.moneta","email":"yersain.aldabayev@moneta.cz"},{"name":"miriamorlikova","email":"miriamorli@seznam.cz"},{"name":"jaroslavbenes","email":"212623435@moneta.cz"}],"homepage":"https://github.com/moneta-digi/mockserver","bin":{"mockserver":"bin\\mockserver.js"},"dist":{"shasum":"62f925f8520aba1952db968caa75a900a94099d1","tarball":"https://registry.npmjs.org/@mmb-digital/mockserver/-/mockserver-1.4.4.tgz","fileCount":43,"integrity":"sha512-qG1zb9oHm+LBqjyXbNNdFe1hmVWAZRJ282CrPVWYXu+cakqiu8l8jjagbi7FO+opuFxJduJe4/jhOc1RsJ4PHQ==","signatures":[{"sig":"MEYCIQDd+3SJuXMbldoSLmvtO5pMvh64JOT7Bqajyqauu4jc1AIhAOI5e2xoJ4NxNVgasTT1o+M9yphfBUcJCdUWh8KRI/H5","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34663},"main":"mockserver.js","scripts":{"test":"mocha -b"},"_npmUser":{"name":"martin.jirak","email":"martin.jirak@moneta.cz"},"repository":{"url":"https://github.com/moneta-digi/mockserver","type":"git"},"description":"Easily mock your webservices while testing frontends.","directories":{},"dependencies":{"yargs":"^1.3.3","colors":"^1.0.3","js-combinatorics":"^0.4.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"12.0.0","mock-req":"^0.2.0"},"_npmOperationalInternal":{"tmp":"tmp/mockserver_1.4.4_1788763365896_0.8558332994080464","host":"s3://npm-registry-packages-npm-production"}},"1.4.5":{"name":"@mmb-digital/mockserver","version":"1.4.5","keywords":["test","mock","api","webservice","rest","namshi"],"author":{"name":"Mohammad Hallal","email":"mohd.hallal@gmail.com"},"license":"MIT","_id":"@mmb-digital/mockserver@1.4.5","maintainers":[{"name":"josefzamrzla","email":"josef.zamrzla@gmail.com"},{"name":"janprasil","email":"prasil.honza@gmail.com"},{"name":"roman.polansky","email":"roman.polansky@moneta.cz"},{"name":"honzadanhel","email":"jjoohhhnnyy@gmail.com"},{"name":"lukasvitek.cz","email":"kontakt@lukasvitek.cz"},{"name":"janacek80","email":"janacek@centrum.cz"},{"name":"martin.jirak","email":"martin.jirak@moneta.cz"},{"name":"novotnydaniel","email":"novotny.daniel@outlook.com"},{"name":"wafflepie","email":"vaclav.janc@gmail.com"},{"name":"yersain.moneta","email":"yersain.aldabayev@moneta.cz"},{"name":"miriamorlikova","email":"miriamorli@seznam.cz"},{"name":"jaroslavbenes","email":"212623435@moneta.cz"}],"homepage":"https://github.com/moneta-digi/mockserver","bin":{"mockserver":"bin\\mockserver.js"},"dist":{"shasum":"dc4b217c76ab8608e7b9269642167762a1463233","tarball":"https://registry.npmjs.org/@mmb-digital/mockserver/-/mockserver-1.4.5.tgz","fileCount":43,"integrity":"sha512-+sl/E4DnMJbBRE4OjbWnHYHa6tsRbsGQzSEIovFVpxZKL9YAg4x3yBn9baHr+YurlJITLTAoD05qgIcSp+vq2w==","signatures":[{"sig":"MEUCIEA96Cb/SlvRXGJ83+Wa3nvfNjLqpYznV/b6wiXu0b9VAiEApIkIaT0/eaaCidDAnAyUG4f/iLjO4wOGiVTvbzP/U1Y=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34662},"main":"mockserver.js","scripts":{"test":"mocha -b"},"_npmUser":{"name":"martin.jirak","email":"martin.jirak@moneta.cz"},"repository":{"url":"https://github.com/moneta-digi/mockserver","type":"git"},"description":"Easily mock your webservices while testing frontends.","directories":{},"dependencies":{"yargs":"^1.3.3","colors":"^1.0.3","js-combinatorics":"^0.4.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"12.0.0","mock-req":"^0.2.0"},"_npmOperationalInternal":{"tmp":"tmp/mockserver_1.4.5_1788763966806_0.8252967753326852","host":"s3://npm-registry-packages-npm-production"}},"1.4.6":{"name":"@mmb-digital/mockserver","version":"1.4.6","description":"Easily mock your webservices while testing frontends.","main":"mockserver.js","scripts":{"test":"mocha -b"},"bin":{"mockserver":"bin\\mockserver.js"},"repository":{"type":"git","url":"https://github.com/moneta-digi/mockserver"},"keywords":["test","mock","api","webservice","rest","namshi"],"author":{"name":"Mohammad Hallal","email":"mohd.hallal@gmail.com"},"license":"MIT","homepage":"https://github.com/moneta-digi/mockserver","dependencies":{"colors":"^1.0.3","js-combinatorics":"^0.4.0","yargs":"^1.3.3"},"devDependencies":{"mocha":"12.0.0","mock-req":"^0.2.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_id":"@mmb-digital/mockserver@1.4.6","dist":{"shasum":"062112c658dd3976f8d0338c7138e2d26665633f","integrity":"sha512-Wx36AbUGQEaTN7WQQXujcvlnjfsmiu6qGNuA4Yftn5OAxutJNzo3kFJtLThhFMan4Axi9nMu2WZ9I4TQmVydvw==","tarball":"https://registry.npmjs.org/@mmb-digital/mockserver/-/mockserver-1.4.6.tgz","fileCount":43,"unpackedSize":34662,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICgAdZUbDB+XFh4q+/kigRJ1yfRZe0lFXsKcZazdwOVKAiAqUPmINyaQ2JkcV/TO8dkYCF8Y/G6mbpQFLQ8IoKOlXw=="}]},"_npmUser":{"name":"martin.jirak","email":"martin.jirak@moneta.cz"},"directories":{},"maintainers":[{"name":"josefzamrzla","email":"josef.zamrzla@gmail.com"},{"name":"janprasil","email":"prasil.honza@gmail.com"},{"name":"roman.polansky","email":"roman.polansky@moneta.cz"},{"name":"honzadanhel","email":"jjoohhhnnyy@gmail.com"},{"name":"lukasvitek.cz","email":"kontakt@lukasvitek.cz"},{"name":"janacek80","email":"janacek@centrum.cz"},{"name":"martin.jirak","email":"martin.jirak@moneta.cz"},{"name":"novotnydaniel","email":"novotny.daniel@outlook.com"},{"name":"wafflepie","email":"vaclav.janc@gmail.com"},{"name":"yersain.moneta","email":"yersain.aldabayev@moneta.cz"},{"name":"miriamorlikova","email":"miriamorli@seznam.cz"},{"name":"jaroslavbenes","email":"212623435@moneta.cz"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mockserver_1.4.6_1788764027487_0.5501221248585908"},"_hasShrinkwrap":false}},"time":{"created":"2022-01-24T10:26:53.845Z","modified":"2026-09-07T06:53:47.770Z","1.3.0":"2022-01-24T10:26:54.040Z","1.4.4":"2026-09-07T06:42:46.031Z","1.4.5":"2026-09-07T06:52:46.951Z","1.4.6":"2026-09-07T06:53:47.611Z"},"author":{"name":"Mohammad Hallal","email":"mohd.hallal@gmail.com"},"license":"MIT","homepage":"https://github.com/moneta-digi/mockserver","keywords":["test","mock","api","webservice","rest","namshi"],"repository":{"type":"git","url":"https://github.com/moneta-digi/mockserver"},"description":"Easily mock your webservices while testing frontends.","maintainers":[{"name":"josefzamrzla","email":"josef.zamrzla@gmail.com"},{"name":"janprasil","email":"prasil.honza@gmail.com"},{"name":"roman.polansky","email":"roman.polansky@moneta.cz"},{"name":"honzadanhel","email":"jjoohhhnnyy@gmail.com"},{"name":"lukasvitek.cz","email":"kontakt@lukasvitek.cz"},{"name":"janacek80","email":"janacek@centrum.cz"},{"name":"martin.jirak","email":"martin.jirak@moneta.cz"},{"name":"novotnydaniel","email":"novotny.daniel@outlook.com"},{"name":"wafflepie","email":"vaclav.janc@gmail.com"},{"name":"yersain.moneta","email":"yersain.aldabayev@moneta.cz"},{"name":"miriamorlikova","email":"miriamorli@seznam.cz"},{"name":"jaroslavbenes","email":"212623435@moneta.cz"}],"readme":"# mockserver\n\n[![Build Status](https://travis-ci.org/namshi/mockserver.svg?branch=master)](https://travis-ci.org/namshi/mockserver)\n\n**mockserver** is a library that will help you mocking your APIs\nin **a matter of seconds**: you simply organize your mocked\nHTTP responses in a bunch of mock files and it will serve them\nlike they were coming from a real API; in this way you can\nwrite your frontends without caring too much whether your\nbackend is really ready or not.\n\n## Installation\n\nMockserver can be installed globally if you need\nto run it as a command:\n\n```\n$ npm install -g mockserver\n\n$ mockserver -p 8080 -m -vb test/mocks\nMockserver serving mocks under \"test/mocks\" at http://localhost:8080\n```\n\nor as a regular NPM module if you need to use it as\na library within your code:\n\n*You can also specify `-vb` argument to the client to log incoming and outgoing requests.*\n\n``` bash\nnpm install mockserver\n```\n\nthen in your test file:\n\n``` javascript\nvar http    =  require('http');\nvar mockserver  =  require('mockserver');\nvar verbose = true;\n\nhttp.createServer(mockserver('path/to/your/mocks', verbose)).listen(9001);\n```\n\nThis will run a simple HTTP webserver, handled by mockserver, on port\n9001.\n\nAt this point you can simply define your first mock: create a file in\n`path/to/your/mocks/example-response` called `GET.mock`:\n\n```\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\n\n{\n   \"Random\": \"content\"\n}\n```\n\nIf you open your browser at `http://localhost:9001/example-response`\nyou will see something like this:\n\n![example output](https://raw.githubusercontent.com/namshi/mockserver/readme/bin/images/example-response.png)\n\nAnd it's over: now you can start writing your frontends without\nhaving to wait for your APIs to be ready, or without having to spend\ntoo much time mocking them, as mockserver lets you do it in seconds.\n\n## Mock files\n\nAs you probably understood, mock files' naming conventions are based\non the response that they are going to serve:\n\n```\n$REQUEST-PATH/$HTTP-METHOD.mock\n```\n\nFor example, let's say that you wanna mock the response of a POST request\nto `/users`, you would simply need to create a file named `POST.mock` under `users/`.\n\nThe content of the mock files needs to be a valid HTTP response, for example:\n\n```\nHTTP/1.1 200 OK\nContent-Type: text/xml; charset=utf-8\n\n{\n   \"Accept-Language\": \"en-US,en;q=0.8\",\n   \"Host\": \"headers.jsontest.com\",\n   \"Accept-Charset\": \"ISO-8859-1,utf-8;q=0.7,*;q=0.3\",\n   \"Accept\": \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\"\n}\n```\n\nCheck [our own mocks](https://github.com/namshi/mockserver/tree/master/test/mocks) as a reference.\n\n## Custom Headers\n\nYou can specify request headers to include, which allows you to change the response based on what headers are\nprovided.  To do this, you need to let mockserver know which headers matter, by setting the\n`headers` array on the mockserver object, like so:\n\n```js\nvar mockserver = require('mockserver');\nmockserver.headers = ['Authorization', 'X-My-Header'];\n```\n\nAny headers that are set and occur within the array will now be appended to the filename, immediately after the\nHTTP method, like so:\n\n```\nGET /hello\nAuthorization: 12345\n\nhello/GET_Authorization=12345.mock\n```\n\n```\nGET /hello\nX-My-Header: cow\nAuthorization: 12345\n\nhello/GET_Authorization=12345_X-My-Header=cow.mock\n```\n\n**Note:** The order of the headers within the `headers` array determines the order of the values within the filename.\n\nThe server will always attempt to match the file with the most tracked headers, then it will try permutations of\nheaders until it finds one that matches.  This means that, in the previous example, the server will look for files\nin this order:\n\n```\nhello/GET_Authorization=12345_X-My-Header=cow.mock\nhello/GET_X-My-Header_Authorization=12345=cow.mock\nhello/GET_Authorization=12345.mock\nhello/GET_X-My-Header=cow.mock\nhello/GET.mock\n```\n\nThe first one matched is the one returned, favoring more matches and headers earlier in the array.\n\nThe `headers` array can be set or modified at any time.\n\n## Query string parameters and POST body\n\nIn order to support query string parameters in the mocked files, replace all occurrences of `?` with `--`, then\nappend the entire string to the end of the file.\n\n```\nGET /hello?a=b\n\nhello/GET--a=b.mock\n```\n\n```\nGET /test?a=b&c=d?\n\ntest/GET--a=b&c=d--.mock\n```\n\n(This has been introduced to overcome issues in file naming on windows)\n\nTo combine custom headers and query parameters, simply add the headers *then* add the parameters:\n\n```\nGET /hello?a=b\nAuthorization: 12345\n\nhello/GET_Authorization=12345--a=b.mock\n```\n\nSimilarly, you can do the same thing with the body of a POST request:\nif you send `Hello=World` as body of the request, mockserver will\nlook for a file called `POST--Hello=World.mock`\n\nIn the same way, if your POST body is a json like `{\"json\": \"yesPlease\"}`,\nmockserver will look for a file called `POST--{\"json\": \"yesPlease\"}.mock`\n\nIf no parametrized mock file is found, mockserver will default to the\nnearest headers based .mock file\n\nex:\n```\nGET /hello?a=b\nAuthorization: 12345\n```\nif there's no `hello/GET_Authorization=12345--a=b.mock`, we'll default to `hello/GET_Authorization=12345.mock` or to `hello/GET.mock`\n\n\n## Tests\n\nTests run on travis, but if you wanna run them locally you simply\nhave to run `mocha` or its verbose cousin `./node_modules/mocha/bin/mocha`\n(if you don't have mocha installed globally).\n","readmeFilename":"README.md"}