{"id":13700956,"url":"https://github.com/jmartin82/mmock","last_synced_at":"2026-02-03T11:14:21.839Z","repository":{"id":37849692,"uuid":"61070826","full_name":"jmartin82/mmock","owner":"jmartin82","description":"Mmock is an HTTP mocking application for testing and fast prototyping","archived":false,"fork":false,"pushed_at":"2026-01-21T23:27:15.000Z","size":2768,"stargazers_count":691,"open_issues_count":28,"forks_count":86,"subscribers_count":11,"default_branch":"master","last_synced_at":"2026-01-26T06:21:15.418Z","etag":null,"topics":["golang","http","httpmock","mock","prototyping","stubbing"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmartin82.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2016-06-13T21:25:43.000Z","updated_at":"2026-01-14T17:20:14.000Z","dependencies_parsed_at":"2024-03-14T17:26:23.052Z","dependency_job_id":"7c6745e2-24f9-406d-b593-11af30eaf545","html_url":"https://github.com/jmartin82/mmock","commit_stats":{"total_commits":252,"total_committers":33,"mean_commits":7.636363636363637,"dds":0.373015873015873,"last_synced_commit":"4f9b3729f93472ce581924a7a70edb3e4477e2ef"},"previous_names":[],"tags_count":65,"template":false,"template_full_name":null,"purl":"pkg:github/jmartin82/mmock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmartin82%2Fmmock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmartin82%2Fmmock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmartin82%2Fmmock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmartin82%2Fmmock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmartin82","download_url":"https://codeload.github.com/jmartin82/mmock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmartin82%2Fmmock/sbom","scorecard":{"id":523991,"data":{"date":"2025-08-11","repo":{"name":"github.com/jmartin82/mmock","commit":"d5b6122a38a5724e7c2a2a16b0e3cb0c0c82dbf5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.1,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":9,"reason":"10 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 9","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":3,"reason":"Found 9/24 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v4.2.1 not signed: https://api.github.com/repos/jmartin82/mmock/releases/224731130","Warn: release artifact v4.2.0 not signed: https://api.github.com/repos/jmartin82/mmock/releases/150653935","Warn: release artifact v4.0.1 not signed: https://api.github.com/repos/jmartin82/mmock/releases/144270356","Warn: release artifact v3.1.6 not signed: https://api.github.com/repos/jmartin82/mmock/releases/102466640","Warn: release artifact v3.1.5 not signed: https://api.github.com/repos/jmartin82/mmock/releases/94387045","Warn: release artifact v4.2.1 does not have provenance: https://api.github.com/repos/jmartin82/mmock/releases/224731130","Warn: release artifact v4.2.0 does not have provenance: https://api.github.com/repos/jmartin82/mmock/releases/150653935","Warn: release artifact v4.0.1 does not have provenance: https://api.github.com/repos/jmartin82/mmock/releases/144270356","Warn: release artifact v3.1.6 does not have provenance: https://api.github.com/repos/jmartin82/mmock/releases/102466640","Warn: release artifact v3.1.5 does not have provenance: https://api.github.com/repos/jmartin82/mmock/releases/94387045"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/jmartin82/mmock/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/jmartin82/mmock/ci.yml/master?enable=pin","Warn: containerImage not pinned by hash: Dockerfile:1: pin your Docker image by updating alpine:3.20 to alpine:3.20@sha256:b3119ef930faabb6b7b976780c0c7a9c1aa24d0c75e9179ac10e6bc9ac080d0d","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 containerImage dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 27 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":5,"reason":"5 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GO-2025-3553 / GHSA-mh63-6h87-95cp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T03:52:13.961Z","repository_id":37849692,"created_at":"2025-08-20T03:52:13.961Z","updated_at":"2025-08-20T03:52:13.961Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29044101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T10:09:22.136Z","status":"ssl_error","status_checked_at":"2026-02-03T10:09:16.814Z","response_time":96,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","http","httpmock","mock","prototyping","stubbing"],"created_at":"2024-08-02T20:01:11.043Z","updated_at":"2026-02-03T11:14:21.808Z","avatar_url":"https://github.com/jmartin82.png","language":"TypeScript","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"![Mmock](/docs/logo.png \"Mmock logo\")\n=========\n\nMmock is a testing and fast prototyping tool for developers:\n\nEasy and fast HTTP mock server.\n\n* Download Mmock\n* Create a mock definition.\n* Configure your application endpoints to use Mmock\n* Receive the expected responses\n* Inspect the requests in the web UI\n* Release it to a real server\n\nBuilt with Go - Mmock runs without installation on multiple platforms.\n\n### Features\n\n* Easy mock definition via JSON or YAML\n* Variables in response (fake or request data)\n* Route patterns may include named parameters (/hello/:name)\n* Glob matching ( * hello * )\n* Match request by method, URL params, query string, headers, cookies and bodies.\n* Mock definitions hot replace (edit your mocks without restart)\n* Web interface to view requests data (method,path,headers,cookies,body,etc..)\n* Stateful behaviour with scenarios\n* Verifying\n* Proxy mode\n* Fine grain log info in web interface\n* Real-time updates using WebSockets\n* Priority matching\n* Crazy mode for failure testing\n* Public interface auto discover\n* Lightweight and portable\n* No installation required\n\n### Example\n\n![Video of Mmock](/docs/example.gif \"Mmock example\")\n\nMock definition file example:\n\n```json\n{\n\t\"request\": {\n\t\t\"method\": \"GET\",\n\t\t\"path\": \"/hello/*\"\n\t},\n\t\"response\": {\n\t\t\"statusCode\": 200,\n\t\t\"headers\": {\n\t\t\t\"Content-Type\":[\"application/json\"]\n\t\t},\n\t\t\"body\": \"{\\\"hello\\\": \\\"{{request.query.name}}, my name is {{fake.FirstName}}\\\"}\"\n\t}\n}\n\n```\nOr\n\n\n```yaml\n---\nrequest:\n  method: GET\n  path: \"/hello/*\"\nresponse:\n  statusCode: 200\n  headers:\n    Content-Type:\n    - application/json\n  body: '{\"hello\": \"{{request.query.name}}, my name is {{fake.FirstName}}\"}'\n\n```\n\nYou can see more complex examples [here](/config).\n\n### Getting started\n\nEither:\n\nRun it from Docker using the provided ```Dockerfile``` or [from Docker Hub](https://hub.docker.com/r/jordimartin/mmock/)\n\n```\ndocker image pull jordimartin/mmock\ndocker run -v YOUR_ABS_PATH:/config -p 8082:8082 -p 8083:8083 jordimartin/mmock\n```\n\nOr run mmock locally from the command line. (Requires Go 1.8 at least)\n\n```\ngo get github.com/jmartin82/mmock/...\nmmock -h\n\n```\n\nTo configure Mmock, use command line flags described in help.\n\n\n```\n    Usage of ./mmock:\n\t  -config-path string\n\t\tMocks definition folder (default \"execution_pathconfig\")\n\t  -console\n\t\tConsole enabled  (true/false) (default true)\n\t  -console-ip string\n\t\tConsole server IP (default \"public_ip\")\n\t  -console-port int\n\t\tConsole server Port (default 8082)\n \t  -request-storage-capacity int\n\t\tRequest storage capacity (0 = infinite) (default 100)\n\t  -results-per-page uint\n\t\tNumber of results per page (default 25)\n\t  -server-ip string\n\t\tMock server IP (default \"public_ip\")\n\t  -server-port int\n\t\tMock server Port (default 8083)\n\t  -server-statistics\n\t\tMock server sends anonymous statistics (default true)\n\t  -server-tls-port int\n\t\tMock server TLS Port (default 8084)\n\t  -tls-path string\n\t\tTLS config folder (server.crt and server.key should be inside) (default \"execution_path/tls\")\n```\n\nThe default logging level is INFO, but you can change it by setting the\nenvironment variable LOG_LEVEL to one of the following:\n\n  * CRITICAL\n  * ERROR\n  * WARNING\n  * NOTICE\n  * INFO\n  * DEBUG\n\n### Mock\n\nMock definition:\n\n```json\n{\n\t\"description\": \"Some text that describes the intended usage of the current configuration\",\n\t\"request\": {\n\t\t\"host\": \"example.com\",\n\t\t\"method\": \"GET|POST|PUT|PATCH|...\",\n\t\t\"path\": \"/your/path/:variable\",\n\t\t\"queryStringParameters\": {\n\t\t\t\"name\": [\"value\"],\n\t\t\t\"name\": [\"value\", \"value\"]\n\t\t},\n\t\t\"headers\": {\n\t\t\t\"name\": [\"value\"]\n\t\t},\n\t\t\"cookies\": {\n\t\t\t\"name\": \"value\"\n\t\t},\n\t\t\"body\": \"Expected Body\"\n\t},\n\t\"response\": {\n\t\t\"statusCode\": \"int (2xx,4xx,5xx,xxx)\",\n\t\t\"headers\": {\n\t\t\t\"name\": [\"value\"]\n\t\t},\n\t\t\"cookies\": {\n\t\t\t\"name\": \"value\"\n\t\t},\n\t\t\"body\": \"Response body\"\n\t},\n\t\"callback\": {\n\t\t\"method\": \"GET|POST|PUT|PATCH|...\",\n\t\t\"url\": \"http://your-callback/\",\n\t\t\"delay\": \"string (response delay in s,ms)\",\n\t\t\"headers\": {\n\t\t\t\"name\": [\"value\"]\n\t\t},\n\t\t\"body\": \"Response body\"\n\t},\n\t\"control\": {\n\t\t\"scenario\": {\n\t\t\t\"name\": \"string (scenario name)\",\n\t\t\t\"requiredState\": [\n\t\t\t\t\"not_started (default state)\",\n\t\t\t\t\"another_state_name\"\n\t\t\t],\n\t\t\t\"newState\": \"new_stat_neme\"\n\t\t},\n\t\t\"proxyBaseURL\": \"string (original URL endpoint)\",\n\t\t\"delay\": \"string (response delay in s,ms)\",\n\t\t\"crazy\": \"bool (return random 5xx)\",\n\t\t\"priority\": \"int (matching priority)\",\n\t\t\"webHookURL\" : \"string (URL endpoint)\"\n\t}\n}\n\n```\n\n#### Request\n\nA core feature of Mmock is the ability to return canned HTTP responses for requests matching criteria.\n\n* *host*: Request http host. (without port)\n* *method*: Request http method. It allows more than one separated by pipes \"|\" **Mandatory**\n* *path*: Resource identifier. It allows :value matching. **Mandatory**\n* *queryStringParameters*: Array of query strings. It allows more than one value for the same key.\n* *headers*: Array of headers. It allows more than one value for the same key. **Case sensitive!**\n* *cookies*: Array of cookies.\n* *body*: Body string. It allows * pattern. It also supports regular expressions for field values within JSON request bodies.\n\nIn case of queryStringParameters, headers and cookies, the request can be matched only if all defined keys in mock will be present with the exact or glob value.\n\nGlob matching is available for:\n* host\n* path\n* headers\n* cookies\n* query strings\n* body\n\nQuery strings and headers support also global matches (*) in the header/parameter name. For example:\n```json\n\t\t\"headers\": {\n\t\t\t\"Custom-Header-*\": [\n\t\t\t\t\"partial val*\"\n\t\t\t]\n\t\t}\n```\n\nRegexp matching is available for:\n- body\n- query strings\n\nSee https://pkg.go.dev/regexp/syntax for regexp syntax\n\n#### Response (Optional on proxy call)\n\n* *statusCode*: Response status code\n* *headers*: Array of headers. It allows more than one value for the same key and vars.\n* *cookies*: Array of cookies. It allows vars.\n* *body*: Body string. It allows vars.\n\n#### Callback (Optional)\n\nThis is used to have mmock make an API request after receiving the mocked request.\n\n* *delay*: Delay before making the callback\n* *url*: URL to make a request to\n* *method*: Request http method\n* *headers*: Array of headers. It allows more than one value for the same key.\n* *body*: Body string. It allows vars.\n* *timeout*: Duration to allow the callback to respond (default 10s)\n\n#### Control (Optional)\n\n* *scenario*; A scenario is essentially a state machine whose states can be arbitrarily assigned.\n* *proxyBaseURL*: If this parameter is present, it sends the request data to the BaseURL and resend the response to de client. Useful if you don't want mock a the whole service. NOTE: It's not necessary fill the response field in this case.\n* *delay*: Delay the response. Simulate bad connection or bad server performance.\n* *crazy*: Return random server errors (5xx) in some request. Simulate server problems.\n* *priority*: Set the priority to avoid match in less restrictive mocks. Higher, more priority.\n* *webHookURL*: After any match if this option is defined it will notify the match to the desired endpoint.\n\n### Variable tags\n\nYou can use variable data in response. The variables will be defined as tags like this {{nameVar}}\n\n - URI\n - description\n\n**Request data:** Use them if you want to add request data in your response.\n\n - request.scheme\n - request.hostname\n - request.port\n - request.path (full path)\n - request.path.\"*key*\"\n - request.query.\"*key*\"\n - request.cookie.\"*key*\"\n - request.fragment\n - request.url (full url with scheme, hostname, port, path and query parameters)\n - request.authority (return scheme, hostname and port (optional))\n - request.body\n\nYou can extract information from the request body too, using a dot notation path:\n \n - request.body.\"*key*\" (support for `application/json`, `application/xml` and `application/x-www-form-urlencoded` requests)\n - request.body.\"*deep*\".\"*key*\" (support for `application/json`, `application/xml` requests)\n\nQuick overview of the path syntax available to extract values form the request: [https://github.com/tidwall/gjson#path-syntax](https://github.com/tidwall/gjson#path-syntax)\n\nYou can also use \"regex\" and \"concat\" commands to complement GJson query:\n\n- request.body.\"*deep*\".\"*key*\".regex() (support for `application/json`, `application/xml` requests)\n- request.body.\"*deep*\".\"*key*\".concat() (support for `application/json`, `application/xml` requests)\n- request.body.\"*deep*\".\"*key*\".regex().concat() (support for `application/json`, `application/xml` requests)\n\n**Example request data:**\n```json\n{\n  \"email\": \"hilari@sapo.pt\",\n  \"age\": 4,\n  \"uuid\":\"^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$\",\n  \"discarded\": \"do not return\"\n}\n```\n**Example config mock data:**\n```json\n{\n  \"email\": \"{{request.body.email.regex((\\@gmail.com))}}\",\n  \"age\": {{request.body.age}},\n  \"uuid\": \"{{request.body.uuid.regex(\\b([0-9a-zA-Z]{4})\\b).concat(-878787)}}\",\n  \"discarded\": \"{{request.body.discarded.concat(, Please!)}}\"\n}\n```\n**Example response data:**\n```json\n{\n  \"email\": \"\",\n  \"age\": 4,\n  \"uuid\": \"2307-878787\",\n  \"discarded\": \"do not return, Please!\"\n}\n```\n\n**External streams:** Perfect for embedding big payloads or getting data from another service.\n\n - file.contents(FILE_PATH)\n - http.contents(URL)\n\n**[Fake](https://godoc.org/github.com/icrowley/fake) data:** Useful to provide a more rich and random response.\n\n - fake.Brand\n - fake.Character\n - fake.Characters\n - fake.CharactersN(n)\n - fake.City\n - fake.Color\n - fake.Company\n - fake.Continent\n - fake.Country\n - fake.CreditCardVisa\n - fake.CreditCardMasterCard\n - fake.CreditCardAmericanExpress\n - fake.Currency\n - fake.CurrencyCode\n - fake.Day\n - fake.Digits\n - fake.DigitsN(n)\n - fake.EmailAddress\n - fake.FirstName\n - fake.FullName\n - fake.LastName\n - fake.Gender\n - fake.Hex(n) - random hexidecimal string n characters in length\n - fake.IPv4\n - fake.Language\n - fake.Model\n - fake.Month\n - fake.MonthShort\n - fake.MonthNum\n - fake.Year\n - fake.Paragraph\n - fake.Paragraphs\n - fake.ParagraphsN(n)\n - fake.Phone\n - fake.Product\n - fake.Sentence\n - fake.Sentences\n - fake.SentencesN(n)\n - fake.SimplePassword\n - fake.State\n - fake.StateAbbrev\n - fake.Street\n - fake.StreetAddress\n - fake.UserName\n - fake.WeekDay\n - fake.Word\n - fake.Words\n - fake.WordsN(n)\n - fake.Zip\n - fake.Int(n) - random positive integer less than or equal to n\n - fake.IntMinMax(min, max) - random positive number greater or equal to min and less than max\n - fake.Float(n) - random positive floating point number less than n\n - fake.UUID - generates a unique id  \n\n### Scenarios\n\nWith the scenarios you can simulate a stateful service. It's useful to create test doubles.\n\nA scenario is a state machine and you can assign an arbitrarily state.\n\nWhen mmock recieve a new request and there is an scenario defined in the matching mock, mmock checks if the mock is valid for the current state. Also a new scenario state can be set after the mock match.\n\nBy default all scenarios has the state \"not_started\" until some mock triggers a new one.\n\nExample of REST services using scenarios:\n\n```\n+---------------------------------------------------------------------------------------------+\n|                                                                                             |\n|   GET /user                     POST /user                     GET /user                    |\n|   StatusCode: 404               StatusCode: 201                StatusCode: 200              |\n|                                                                                             |\n|  +-------------------------+   +---------------------------+   +-------------------------+  |\n|  |                         |   |                           |   |                         |  |\n|  | requiredState:created   +-\u003e | requiredState:not_started +-\u003e |  requiredState: created |  |\n|  |                         |   | newState: created         |   |                         |  |\n|  |                         |   |                           |   |                         |  |\n|  +-------------------------+   +---------------------------+   +-------------------------+  |\n|                                                                                             |\n+---------------------------------------------------------------------------------------------+\n```\n\nWorking examples [here](/config/crud)\n\n## API Specification\n\nMMock uses the Open API Specification (OAI, formerly known as Swagger) to describe its APIs. Our OAI specification schema is hosted at /swagger.json and serves as the canonical definition and comprehensive declaration of all available endpoints.\n\nThe OAI specification makes writing client applications easier by: auto-generating boilerplate code (like data object classes) and dealing with authentication and error handling.\n\nYou can find a comprehensive set of open tools for the OAI specification at: https://github.com/swagger-api.\n\n#### REST Endpoints\n\n### Verify\n\nThe Mmock records the incoming requests in memory (last 100 by default). \nThis makes it possible to verify that a request matching a specific pattern was received, and also to fetch the requests details.\n\n**Title** : Get all requests.\u003cbr\u003e\n**URL** : /api/request/all\u003cbr\u003e\n**Method** : GET\u003cbr\u003e\n**Response Codes**: Success (200 OK)\u003cbr\u003e\n\n**Title** : Get all matched requests with any mock.\u003cbr\u003e\n**URL** : /api/request/matched\u003cbr\u003e\n**Method** : GET\u003cbr\u003e\n**Response Codes**: Success (200 OK)\u003cbr\u003e\n\n**Title** : Clean all recorded request.\u003cbr\u003e\n**URL** : /api/request/reset\u003cbr\u003e\n**Method** : GET\u003cbr\u003e\n**Response Codes**: Success (200 OK)\u003cbr\u003e\n\n**Title** : Reset all requests that match with an specific pattern.\u003cbr\u003e\n**URL** : /api/request/reset_match\u003cbr\u003e\n**Method** : POST\u003cbr\u003e\n**Data Params**:  \u003cbr\u003e\n\nLike stubbing this call also uses the same DSL to filter and query requests.\n\n```json\n{\n\t\"host\": \"example.com\",\n\t\"method\": \"GET|POST|PUT|PATCH|... (Mandatory)\", \n\t\"path\": \"/your/path/:variable (Mandatory)\",\n\t\"queryStringParameters\": {\n\t\t\"name\": [\"value\"],\n\t\t\"name\": [\"value\", \"value\"]\n\t},\n\t\"headers\": {\n\t\t\"name\": [\"value\"]\n\t},\n\t\"cookies\": {\n\t\t\"name\": \"value\"\n\t},\n\t\"body\": \"Expected Body\"\n}\n```\n**Response Codes**: Success (200 OK)\u003cbr\u003e\n\n**Title** : Get all non matched requests.\u003cbr\u003e\n**URL** : /api/request/unmatched\u003cbr\u003e\n**Method** : GET\u003cbr\u003e\n**Response Codes**: Success (200 OK)\u003cbr\u003e\n\n**Title** : Get all requests that match with an specific pattern.\u003cbr\u003e\n**URL** : /api/request/verify\u003cbr\u003e\n**Method** : POST\u003cbr\u003e\n**Data Params**:  \u003cbr\u003e\n\nLike stubbing this call also uses the same DSL to filter and query requests.\n\n```json\n{\n\t\"host\": \"example.com\",\n\t\"method\": \"GET|POST|PUT|PATCH|... (Mandatory)\", \n\t\"path\": \"/your/path/:variable (Mandatory)\",\n\t\"queryStringParameters\": {\n\t\t\"name\": [\"value\"],\n\t\t\"name\": [\"value\", \"value\"]\n\t},\n\t\"headers\": {\n\t\t\"name\": [\"value\"]\n\t},\n\t\"cookies\": {\n\t\t\"name\": \"value\"\n\t},\n\t\"body\": \"Expected Body\"\n}\n```\n**Response Codes**: Success (200 OK)\u003cbr\u003e\n\n### Scenario\n\n**Title** : Get all active scenarios.\u003cbr\u003e\n**URL** : /api/scenarios\u003cbr\u003e\n**Method** : GET\u003cbr\u003e\n**Response Codes**: Success (200 OK)\u003cbr\u003e\n\n**Title** : Clean all scenarios status and pause state.\u003cbr\u003e\n**URL** : /api/scenarios/reset_all\u003cbr\u003e\n**Method** : GET\u003cbr\u003e\n**Response Codes**: Success (200 OK)\u003cbr\u003e\n\n**Title** : Manually progress a scenario state machine to the given state.\u003cbr\u003e\n**URL** : /api/scenarios/set/:scenario/:state\u003cbr\u003e\n**Method** : PUT\u003cbr\u003e\n**Response Codes**: Success (200 OK)\u003cbr\u003e\n\n**Title** : Pause prevents all scenarios state machines from progressing to a new state.\u003cbr\u003e\n**URL** : /api/scenarios/pause\u003cbr\u003e\n**Method** : PUT\u003cbr\u003e\n**Response Codes**: Success (200 OK)\u003cbr\u003e\n\n**Title** : Allow scenarios state machines to continue.\u003cbr\u003e\n**URL** : /api/scenarios/unpause\u003cbr\u003e\n**Method** : PUT\u003cbr\u003e\n**Response Codes**: Success (200 OK)\u003cbr\u003e\n\n### Mapping\n\nYou can manage remotely your stub mappings whenever you need with this simple API:\n\n**Title** : Get all mock definitions.\u003cbr\u003e\n**URL** : /api/mapping \u003cbr\u003e\n**Method** : GET\u003cbr\u003e\n**Response Codes**: Success (200 OK)\u003cbr\u003e\n\n**Title** : Create new mock definition.\u003cbr\u003e\n**URL** : /api/mapping/:uri \u003cbr\u003e\n**Method** : POST\u003cbr\u003e\n**Response Codes**: Success (201 OK)\u003cbr\u003e\n\n**Title** : Get mock definition.\u003cbr\u003e\n**URL** : /api/mapping/:uri \u003cbr\u003e\n**Method** : GET\u003cbr\u003e\n**Response Codes**: Success (200 OK)\u003cbr\u003e\n\n**Title** : Update mock definition.\u003cbr\u003e\n**URL** : /api/mapping/:uri \u003cbr\u003e\n**Method** : PUT\u003cbr\u003e\n**Response Codes**: Success (200 OK)\u003cbr\u003e\n\n**Title** : Delete mock definition.\u003cbr\u003e\n**URL** : /api/mapping/:uri \u003cbr\u003e\n**Method** : DELETE\u003cbr\u003e\n**Response Codes**: Success (200 OK)\u003cbr\u003e)\n\n#### Realtime Endpoints\n\nAlso there is a real time endpoint available through WebSockets that broadcast all requests.\n\n**Title** : Get all requests.\u003cbr\u003e\n**URL** : /echo \u003cbr\u003e\n\n\n#### Output\n\nAll endpoints have the same output format:\n\n```json\n[\n  {\n    \"time\": 1486563983,\n    \"request\": {\n      \"host\": \"192.168.20.209\",\n      \"method\": \"GET\",\n      \"path\": \"/hello\",\n      \"queryStringParameters\": {},\n      \"headers\": {\n        \"Accept\": [\n          \"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\"\n        ]\n      },\n      \"cookies\": {},\n      \"body\": \"\"\n    },\n    \"response\": {\n      \"statusCode\": 200,\n      \"headers\": null,\n      \"cookies\": {\n        \"visit\": \"true\"\n      },\n      \"body\": \"Hello world!\"\n    },\n    \"result\": {\n      \"match\": true,\n      \"errors\": null\n    }\n  }\n]\n```\n\n### Statistics\n\nMmock is collecting anonymous statistics about the usage of the following actions:\n\nSource code: [/statistics/statistics.go](https://github.com/jmartin82/mmock/blob/master/internal/statistics/statistics.go#L30)\n\n- `requests.mock`: Mocks served (number) \n- `requests.console`: Web console usage (number)\n- `requests.verify`: Verify requests (number)\n- `feature.scenario`: Mocks with scenario feature served (number)\n- `feature.proxy`: Mocks with proxy feature served (number)\n\nYou can always disable this behavior adding the following flag `-server-statistics=false`\n\n\n### Contributors\n- Amazing request body parsing form [@hmoragrega](https://github.com/hmoragrega)\n- Awesome use statistics from [@alfonsfoubert](https://github.com/alfonsfoubert)\n- More request variables available thanks to [@Bartek-CMP](https://github.com/Bartek-CMP)\n- Scenario pause feature thanks to [@Nekroze](https://github.com/Nekroze)\n- Storage reset feature thanks to [@rubencougil](https://github.com/rubencougil)\n- Improved docker image thanks to [@daroot](https://github.com/daroot)\n- Added the possibility of access to an array index in dynamic responses [@jaimelopez](https://github.com/jaimelopez)\n- Create mapping via console thanks to [@inabajunmr](https://github.com/inabajunmr)\n- Thanks to [@joel-44](https://github.com/joel-44) for bug fixing \n- Enviroment variables as mock variables thanks to [@marcoreni](https://github.com/marcoreni)\n- Support Regular Expressions for Field Values in JSON Request Body thanks to [@rosspatil](https://github.com/rosspatil)\n- Improved logging with levels thanks to [@jcdietrich](https://github.com/jcdietrich) [@jdietrich-tc](https://github.com/jdietrich-tc)\n- Support for Regular Expressions for QueryStringParameters [@jcdietrich](https://github.com/jcdietrich) [@jdietrich-tc](https://github.com/jdietrich-tc)\n- Support for URI and Description tags [@jcdietrich](https://github.com/jcdietrich) [@jdietrich-tc](https://github.com/jdietrich-tc)\n\n### Contributing\n\nAs of version 3.0.0, Mmock is available as a Go module. Therefore a Go version capable of understanding /vN suffixed imports is required:\n\n1.9.7+\n1.10.3+\n1.11+\n\nIf you make any changes, please run ```go fmt ./...``` before submitting a pull request.\n\n### Licence\n\nCopyright © 2016 - 2020, Jordi Martín (http://jordi.io)\n\nReleased under MIT license, see [LICENSE](LICENSE.md) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmartin82%2Fmmock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmartin82%2Fmmock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmartin82%2Fmmock/lists"}