{"id":34979471,"url":"https://github.com/beyond-the-cloud-dev/http-mock-lib","last_synced_at":"2026-04-01T20:58:53.406Z","repository":{"id":258369881,"uuid":"867544626","full_name":"beyond-the-cloud-dev/http-mock-lib","owner":"beyond-the-cloud-dev","description":"Simpler Apex Http Callouts mocking.","archived":false,"fork":false,"pushed_at":"2026-03-12T21:23:24.000Z","size":1733,"stargazers_count":36,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-13T03:45:29.599Z","etag":null,"topics":["apex","apex-fluently","apex-mocking"],"latest_commit_sha":null,"homepage":"https://httpmock.beyondthecloud.dev/","language":"Apex","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/beyond-the-cloud-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","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":"2024-10-04T09:11:06.000Z","updated_at":"2026-03-12T21:21:35.000Z","dependencies_parsed_at":"2025-02-10T08:34:21.514Z","dependency_job_id":null,"html_url":"https://github.com/beyond-the-cloud-dev/http-mock-lib","commit_stats":null,"previous_names":["beyond-the-cloud-dev/http-mock-lib"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/beyond-the-cloud-dev/http-mock-lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyond-the-cloud-dev%2Fhttp-mock-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyond-the-cloud-dev%2Fhttp-mock-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyond-the-cloud-dev%2Fhttp-mock-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyond-the-cloud-dev%2Fhttp-mock-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beyond-the-cloud-dev","download_url":"https://codeload.github.com/beyond-the-cloud-dev/http-mock-lib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyond-the-cloud-dev%2Fhttp-mock-lib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31013968,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-27T02:58:54.984Z","status":"ssl_error","status_checked_at":"2026-03-27T02:58:46.993Z","response_time":164,"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":["apex","apex-fluently","apex-mocking"],"created_at":"2025-12-27T00:55:07.937Z","updated_at":"2026-03-27T03:17:15.353Z","avatar_url":"https://github.com/beyond-the-cloud-dev.png","language":"Apex","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://apexfluently.beyondthecloud.dev/libraries/http-mock-lib.html\"\u003e\n    \u003cpicture\u003e\n      \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"./website/public/logo.png\"\u003e\n      \u003cimg alt=\"HTTP Mock Lib logo\" src=\"./website/public/logo.png\" height=\"98\"\u003e\n    \u003c/picture\u003e\n  \u003c/a\u003e\n  \u003ch1\u003eHTTP Mock Lib\u003c/h1\u003e\n\n\u003ca href=\"https://beyondthecloud.dev\"\u003e\u003cimg alt=\"Beyond The Cloud logo\" src=\"https://img.shields.io/badge/MADE_BY_BEYOND_THE_CLOUD-555?style=for-the-badge\"\u003e\u003c/a\u003e\n\n\u003cimg alt=\"API version\" src=\"https://img.shields.io/badge/api-v65.0-blue?style=for-the-badge\"\u003e\n\u003ca href=\"https://github.com/beyond-the-cloud-dev/soql-lib/blob/main/LICENSE\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/badge/license-mit-green?style=for-the-badge\"\u003e\u003c/a\u003e\n\u003cimg alt=\"GitHub Repo stars\" src=\"https://img.shields.io/github/stars/beyond-the-cloud-dev/http-mock-lib?style=for-the-badge\u0026logo=github\u0026color=blue\"\u003e\n\u003cimg alt=\"GitHub Release\" src=\"https://img.shields.io/github/v/release/beyond-the-cloud-dev/http-mock-lib?display_name=tag\u0026style=for-the-badge\u0026color=blue\"\u003e\n\u003c/div\u003e\n\n# Getting Started\n\nHTTP Mock inspired by Robert Sösemann’s [Apex Http Mock](https://github.com/rsoesemann/apex-httpmock).\n\nHTTP Mock Lib is part of [Apex Fluently](https://apexfluently.beyondthecloud.dev/), a suite of production-ready Salesforce libraries by Beyond the Cloud.\n\n❌❌❌\n\n```java\n@isTest\nglobal class MockHttpResponseGenerator implements HttpCalloutMock {\n    global HTTPResponse respond(HTTPRequest req) {\n        HttpResponse res = new HttpResponse();\n        res.setHeader('Content-Type', 'application/json');\n        res.setBody('{\"example\":\"test\"}');\n        res.setStatusCode(200);\n        return res;\n    }\n}\n\nTest.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());\n```\n\n✅✅✅\n\n```java\nnew HttpMock()\n  .whenGetOn('/api/v1/authorize').body('{\"example\":\"test\"}').statusCodeOk()\n  .mock();\n```\n\n## Example\n\n```java\n@IsTest\nprivate class MyTest {\n  @IsTest\n  static void calloutTest() {\n    new HttpMock()\n      .whenGetOn('/api/v1/authorize').body('{ \"token\": \"aZ3Xb7Qk\" }').statusCodeOk()\n      .whenPostOn('/api/v1/create').body('{ \"success\": true, \"message\": null }').statusCodeOk()\n      .mock();\n\n    Test.startTest();\n    new CalloutService().makeCallout();\n    Test.stopTest();\n\n    // Asserts\n    Assert.areEqual(..., ...);\n  }\n}\n```\n\n## API\n\n```java\npublic interface HttpMockLib {\n    HttpMock whenGetOn(String endpointToMock);\n    HttpMock whenPostOn(String endpointToMock);\n    HttpMock whenPutOn(String endpointToMock);\n    HttpMock whenPatchOn(String endpointToMock);\n    HttpMock whenDeleteOn(String endpointToMock);\n    HttpMock whenTraceOn(String endpointToMock);\n    HttpMock whenHeadOn(String endpointToMock);\n    // Body\n    HttpMock body(Object body);\n    HttpMock body(String body);\n    HttpMock body(Blob body);\n    // Content-Type\n    HttpMock contentTypePlainText(); // text/plain\n    HttpMock contentTypeHtml(); // text/html\n    HttpMock contentTypeCsv(); // text/csv\n    HttpMock contentTypeJson(); // application/json\n    HttpMock contentTypeXml(); // application/xml\n    HttpMock contentTypePdf(); // application/pdf\n    HttpMock contentTypeFormUrlencoded(); // application/x-www-form-urlencoded\n    HttpMock contentType(String contentType);\n    // Status Code\n    HttpMock statusCodeOk(); // 200\n    HttpMock statusCodeCreated(); // 201\n    HttpMock statusCodeAccepted(); // 202\n    HttpMock statusCodeNoContent(); // 204\n    HttpMock statusCodeBadRequest(); // 400\n    HttpMock statusCodeUnauthorized(); // 401\n    HttpMock statusCodeForbidden(); // 403\n    HttpMock statusCodeNotFound(); // 404\n    HttpMock statusCodeMethodNotAllowed(); // 405\n    HttpMock statusCodeInternalServerError(); // 500\n    HttpMock statusCodeNotImplemented(); // 501\n    HttpMock statusCodeBadGateway(); // 502\n    HttpMock statusCodeServiceUnavailable(); // 503\n    HttpMock statusCodeGatewayTimeout(); // 504\n    HttpMock statusCode(Integer statusCode);\n    // Headers\n    HttpMock header(String key, String value);\n    // Mock\n    void mock();\n}\n```\n\n## Documentation\n\nVisit the [documentation](https://httpmock.beyondthecloud.dev/) to view the full documentation.\n\n## Contributors\n\n\u003ca href=\"https://github.com/beyond-the-cloud-dev/http-mock-lib/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=beyond-the-cloud-dev/http-mock-lib\" /\u003e\n\u003c/a\u003e\n\n## License notes:\n\n- For proper license management each repository should contain LICENSE file similar to this one.\n- each original class should contain copyright mark: © Copyright 2025, Beyond The Cloud Sp. z o.o. (BeyondTheCloud.Dev)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyond-the-cloud-dev%2Fhttp-mock-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeyond-the-cloud-dev%2Fhttp-mock-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyond-the-cloud-dev%2Fhttp-mock-lib/lists"}