{"id":30261581,"url":"https://github.com/azayzel/harmockserver","last_synced_at":"2025-09-16T04:06:26.077Z","repository":{"id":300483795,"uuid":"1006291309","full_name":"Azayzel/HarMockServer","owner":"Azayzel","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-22T15:32:36.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"development","last_synced_at":"2025-08-15T20:34:54.182Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Azayzel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-06-21T23:30:29.000Z","updated_at":"2025-06-22T15:31:35.000Z","dependencies_parsed_at":"2025-06-22T00:36:52.871Z","dependency_job_id":null,"html_url":"https://github.com/Azayzel/HarMockServer","commit_stats":null,"previous_names":["azayzel/harmockserver"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Azayzel/HarMockServer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azayzel%2FHarMockServer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azayzel%2FHarMockServer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azayzel%2FHarMockServer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azayzel%2FHarMockServer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Azayzel","download_url":"https://codeload.github.com/Azayzel/HarMockServer/tar.gz/refs/heads/development","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azayzel%2FHarMockServer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275358939,"owners_count":25450454,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-16T02:00:10.229Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-08-15T20:07:53.130Z","updated_at":"2025-09-16T04:06:25.825Z","avatar_url":"https://github.com/Azayzel.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HarMockServer\n\n## Usage Examples\n\n### 1. Upload a HAR file\n```bash\ncurl -X POST \"https://localhost:7000/api/har/upload\" \\\n     -F \"harFile=@exported-requests.har\" \\\n     -F \"environmentName=My Test Environment\"\n```\n\nResponse:\n```json\n{\n  \"environmentId\": \"a1b2c3d4\",\n  \"message\": \"HAR file uploaded successfully\",\n  \"mockUrl\": \"https://localhost:7000/mock/a1b2c3d4\"\n}\n```\n\n### 2. List all environments\n```bash\ncurl -X GET \"https://localhost:7000/api/har/environments\"\n```\n\n### 3. Use mock responses\nIf your HAR contained a request to `GET https://api.example.com/users/123`, you can now call:\n```bash\ncurl -X GET \"https://localhost:7000/mock/a1b2c3d4/users/123\"\n```\n\n### 4. Get environment details\n```bash\ncurl -X GET \"https://localhost:7000/api/har/environments/a1b2c3d4\"\n```\n\n## Key Features\n\n1. **Environment Isolation**: Each HAR file creates a separate environment with its own mock responses\n2. **Domain Replacement**: Original domains are replaced with the local mock server while preserving paths\n3. **Fast Lookup**: In-memory dictionary for O(1) response lookup by method+path\n4. **YARP Integration**: Uses YARP's IHttpForwarder for efficient request handling\n5. **Flexible Matching**: Supports exact path matching and fallback to path-only (ignoring query params)\n6. **Production Ready**: Comprehensive logging, error handling, and scalable architecture\n7. **RESTful API**: Full CRUD operations for managing HAR environments\n\n## Running the Application\n\n1. Create a new .NET 8 Web API project\n2. Replace the default files with the code above\n3. Run: `dotnet run`\n4. Access Swagger UI at: `https://localhost:7000/swagger`\n5. Upload HAR files via the API and start mocking!\n\nThis solution provides a complete, scalable HAR mock server that leverages YARP for efficient request processing and serves immediate mock responses for your testing needs.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazayzel%2Fharmockserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazayzel%2Fharmockserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazayzel%2Fharmockserver/lists"}