{"id":22625553,"url":"https://github.com/mcgppeters/aranea.httpmessagehandler","last_synced_at":"2025-06-26T03:33:03.689Z","repository":{"id":89765187,"uuid":"86314774","full_name":"MCGPPeters/Aranea.HttpMessageHandler","owner":"MCGPPeters","description":null,"archived":false,"fork":false,"pushed_at":"2017-05-20T11:47:13.000Z","size":86,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-06-24T01:49:15.253Z","etag":null,"topics":["asp-net-core","httpmessagehandler","testing"],"latest_commit_sha":null,"homepage":null,"language":"C#","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/MCGPPeters.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-27T09:11:20.000Z","updated_at":"2017-10-16T05:55:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"3f5bcf06-9ac0-475e-b787-dfd221dfa703","html_url":"https://github.com/MCGPPeters/Aranea.HttpMessageHandler","commit_stats":null,"previous_names":["mcgppeters/aspnetcorehttpmessagehandler"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/MCGPPeters/Aranea.HttpMessageHandler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MCGPPeters%2FAranea.HttpMessageHandler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MCGPPeters%2FAranea.HttpMessageHandler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MCGPPeters%2FAranea.HttpMessageHandler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MCGPPeters%2FAranea.HttpMessageHandler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MCGPPeters","download_url":"https://codeload.github.com/MCGPPeters/Aranea.HttpMessageHandler/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MCGPPeters%2FAranea.HttpMessageHandler/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261994666,"owners_count":23242055,"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","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":["asp-net-core","httpmessagehandler","testing"],"created_at":"2024-12-09T00:26:22.793Z","updated_at":"2025-06-26T03:33:03.644Z","avatar_url":"https://github.com/MCGPPeters.png","language":"C#","readme":"# Aranea.HttpMessageHandler\n\nA port of Damian Hickey's [OwinHttpMessageHandler](https://github.com/damianh/OwinHttpMessageHandler) so that the concept can be used for ASP .NET core as well. The readme below shows this as it is also a port of the associated readme :) .\n\n[![NuGet Latest Stable https://www.nuget.org/packages/Aranea.HttpMessageHandler](https://img.shields.io/nuget/v/Aranea.HttpMessageHandler.svg)](https://www.nuget.org/packages/Aranea.HttpMessageHandler)\n[![Build status](https://ci.appveyor.com/api/projects/status/efb11scf69h28i33?svg=true)](https://ci.appveyor.com/project/MCGPPeters/aranea-httpmessagehandler)\n\nAn implementation of System.Net.Http.HttpMessageHandler that translates an HttpRequestMessage into an ASP.NET Core compatible HttpContext, calls the supplied RequestDelegate and translates the result to an HttpResponseMessage. This allows you to call an ASP.NET Core application (RequestDelegate) / Middleware using an HttpClient without actually hitting the network stack. Useful for testing and embedded scenarios.\n\nInstall via NuGet : [![NuGet Latest Stable https://www.nuget.org/packages/Aranea.HttpMessageHandler](https://img.shields.io/nuget/v/Aranea.HttpMessageHandler.svg)](https://www.nuget.org/packages/Aranea.HttpMessageHandler)\n\n## Using\n\n```C#\nvar handler = new AspNetCoreHttpMessageHandler(appFunc) // Alternatively you can pass in Middleware\n{\n    UseCookies = true, // Will send cookies on subsequent requests. Default is false.\n    AllowAutoRedirect = true // The handler will auto follow 301/302\n}\nvar httpClient = new HttpClient(handler)\n{\n    BaseAddress = new Uri(\"http://localhost\")\n}\n\nvar response = await httpClient.GetAsync(\"/\");\n\n```\n\nBy default, the HttpContext is defined to look as though the source of the request is local. You can adjust the  HttpContext via a delegate:\n\n```C#\n\nvar httpClient = new HttpClient(new AspNetCoreHttpMessageHandler(context =\u003e\n{\n    if (context.Request.Path == $\"/{requestPath}\")\n        context.Response.StatusCode = 200;\n\n        ...\n}));\n\n```\n\nMore information on [Http Message Handlers](http://www.asp.net/web-api/overview/working-with-http/http-message-handlers)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcgppeters%2Faranea.httpmessagehandler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcgppeters%2Faranea.httpmessagehandler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcgppeters%2Faranea.httpmessagehandler/lists"}