{"id":44670005,"url":"https://github.com/wenhao/mushrooms","last_synced_at":"2026-02-15T01:36:46.660Z","repository":{"id":57724004,"uuid":"141529758","full_name":"wenhao/mushrooms","owner":"wenhao","description":"Mushrooms is an easy setup  mock or stub framework. To ensure high levels of efficiency for remote service integration.","archived":false,"fork":false,"pushed_at":"2019-03-29T06:41:46.000Z","size":397,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-13T08:55:39.182Z","etag":null,"topics":["cache","failover","mock","mock-server","moco","mushrooms","stub"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wenhao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-19T05:44:33.000Z","updated_at":"2020-10-21T02:43:23.000Z","dependencies_parsed_at":"2022-09-02T06:55:35.813Z","dependency_job_id":null,"html_url":"https://github.com/wenhao/mushrooms","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/wenhao/mushrooms","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wenhao%2Fmushrooms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wenhao%2Fmushrooms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wenhao%2Fmushrooms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wenhao%2Fmushrooms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wenhao","download_url":"https://codeload.github.com/wenhao/mushrooms/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wenhao%2Fmushrooms/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29464421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T01:01:38.065Z","status":"ssl_error","status_checked_at":"2026-02-15T01:01:23.809Z","response_time":53,"last_error":"SSL_read: 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":["cache","failover","mock","mock-server","moco","mushrooms","stub"],"created_at":"2026-02-15T01:36:46.502Z","updated_at":"2026-02-15T01:36:46.649Z","avatar_url":"https://github.com/wenhao.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/wenhao/mushrooms.svg?branch=master)](https://travis-ci.com/wenhao/mushrooms)\n[![Coverage Status](https://coveralls.io/repos/github/wenhao/mushrooms/badge.svg?branch=master)](https://coveralls.io/github/wenhao/mushrooms?branch=master)\n[![Apache 2.0 License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0.txt)\n\n![Mushrooms][logo]\n\n# Mushrooms\n\nMushrooms is an easy setup mock or stub framework. To ensure high levels of efficiency for remote service integration.\n\n## Why\n\nRemote service integration, especially based on HTTP protocol, e.g. web service, REST etc, highly unstable when developing.\n\n### Features\n\n##### Stub\n\nStub feature rely on spring boot and okhttp3, make sure FeignClient/RestTemplate are using okhttp3.\n\n* Stub REST API.\n* Stub Soap API.\n\n### Dependencies\n\n1. io.github.openfeign:feign-okhttp.\n\n### Gradle\n\n```groovy\nrepositories {\n    jcenter()\n}\n\ndependencies {\n    compile 'com.github.wenhao:mushrooms:3.0.8'\n}\n```\n\n### Maven\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.wenhao\u003c/groupId\u003e\n    \u003cartifactId\u003emushrooms\u003c/artifactId\u003e\n    \u003cversion\u003e3.0.8\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Build\n\n```\n./gradlew clean build\n```\n\n### Get Started\n\n**Request Matchers**\n\nA **request matcher** can contain any of the following matchers:\n\n* method - string value as a plain text, regular expression.\n* path - string value as a plain text, regular expression.\n* query string - key to multiple values as a plain text, regular expression.\n* headers - key to multiple values as a plain text, regular expression.\n* body\n    * XPath(example, body: xpath:/Envelope/Body/GetBookRequest[BookName='Java']), **without NAMESPACE**.\n    * XML - full or partial match. \n    * JSON - full or partial match. \n    * JsonPath(example, body: jsonPath:$.store.book[?(@.price \u003c 10)]), [jsonPath syntax](https://github.com/json-path/JsonPath)\n    \n#### Integrate with Spring boot\n\n1. add application.yml configuration, eg.[MushroomsStubConfiguration.java](./src/test/java/com/github/wenhao/mushrooms/integration/config/MushroomsStubConfiguration.java).\n2. initialize StubOkHttpClientInterceptor via spring bean config, eg.[BeanConfiguration.java](./src/test/java/com/github/wenhao/mushrooms/integration/config/BeanConfiguration.java).\n3. override the OkHttpFeignConfiguration if you're using FeignClient, eg.[OkHttpFeignConfiguration](./src/test/java/com/github/wenhao/mushrooms/integration/config/OkHttpFeignConfiguration.java).\n    \n**Full setup**\n```yaml\nmushrooms:\n  stub:\n    enabled: true\n    failover: true\n    stubs:\n      - request:\n          path: ${REAL_HOST:http://localhost:8080}/stub(.*)\n          parameters: \n            - key: [A-z]{0,10}\n              value: [A-Z0-9]+\n          method: P(.*)\n          headers:\n            - key: [A-z]{0,10}\n              value: [A-Z0-9]+\n          body: /stubs/stub_rest_request.json\n        response: /stubs/stub_rest_response.json\n```    \n\n#### Stub Configuration\n\nEnabled mushrooms stub and set stub request and response.\n\n**Stub REST API**\n```yaml\nmushrooms:\n  stub:\n    enabled: true\n    stubs:\n      - request:\n          path: ${REAL_HOST:http://localhost:8080}/stub\n          method: POST\n          body: /stubs/stub_rest_request.json\n        response: /stubs/stub_rest_response.json\n```\n\n**Stub Soap API**\n```yaml\nmushrooms:\n  stub:\n    enabled: true\n    stubs:\n      - request:\n          path: ${REAL_HOST:http://localhost:8080}/stub/get_book\n          method: POST\n          body: /stubs/stub_soap_request.xml\n        response: /stubs/stub_soap_response.xml\n```\n\nEnabled RestTemplate stub, Customize RestTemplate by using Okhttp3, [RestTemplateConfiguration](./src/test/java/com/github/wenhao/mushrooms/integration/config/RestTemplateConfiguration.java).\n\n```java\n@Configuration\npublic class RestTemplateConfiguration {\n\n  @Bean\n  public RestTemplate restTemplate(ClientHttpRequestFactory clientHttpRequestFactory) {\n    return new RestTemplate(clientHttpRequestFactory);\n  }\n\n  @Bean\n  public ClientHttpRequestFactory okHttp3ClientHttpRequestFactory(OkHttpClient okHttpClient) {\n    return new OkHttp3ClientHttpRequestFactory(okHttpClient);\n  }\n}\n```\n\n#### Generic Configuration\n\nIf enabled okhttp stub, enabling feign okhttp client.\n\n```yaml\nfeign:\n  okhttp:\n    enabled: true\n  client:\n    config:\n      default:\n        connectTimeout: 5000\n        readTimeout: 5000\n        loggerLevel: full\n```\n\nLogging\n```yaml\nlogging:\n  level:\n    com.github.wenhao.mushrooms: DEBUG\n```\n\n#### Failover\n\nAs Failover is true, will call real endpoint first and return real response if health.\n\n### Copyright and license\n\nCopyright © 2018-2019 Wen Hao\n\nLicensed under [Apache License]\n\n[logo]: ./docs/images/logo.png\n[Apache License]: ./LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwenhao%2Fmushrooms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwenhao%2Fmushrooms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwenhao%2Fmushrooms/lists"}