{"id":21954813,"url":"https://github.com/mgernand/aspnetcore.problemdetails","last_synced_at":"2025-07-22T09:31:13.730Z","repository":{"id":38299803,"uuid":"489330965","full_name":"mgernand/AspNetCore.ProblemDetails","owner":"mgernand","description":"A middleware to create RFC 7807 problem details for APIs.","archived":false,"fork":false,"pushed_at":"2024-11-14T12:36:26.000Z","size":79,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-14T12:59:33.401Z","etag":null,"topics":["api","asp-net-core","aspnet-core","aspnetcore","dotnet","dotnet-core","dotnetcore","middleware","problem-details"],"latest_commit_sha":null,"homepage":"","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/mgernand.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":"2022-05-06T11:37:50.000Z","updated_at":"2024-11-14T12:36:14.000Z","dependencies_parsed_at":"2024-07-09T10:14:59.600Z","dependency_job_id":null,"html_url":"https://github.com/mgernand/AspNetCore.ProblemDetails","commit_stats":{"total_commits":19,"total_committers":2,"mean_commits":9.5,"dds":0.4736842105263158,"last_synced_commit":"ce76448309bc5cb9c077c7f0f0855333813a1204"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgernand%2FAspNetCore.ProblemDetails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgernand%2FAspNetCore.ProblemDetails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgernand%2FAspNetCore.ProblemDetails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgernand%2FAspNetCore.ProblemDetails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mgernand","download_url":"https://codeload.github.com/mgernand/AspNetCore.ProblemDetails/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227069533,"owners_count":17726231,"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":["api","asp-net-core","aspnet-core","aspnetcore","dotnet","dotnet-core","dotnetcore","middleware","problem-details"],"created_at":"2024-11-29T07:26:11.869Z","updated_at":"2024-11-29T07:26:12.375Z","avatar_url":"https://github.com/mgernand.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AspNetCore.ProblemDetails\n\nA middleware to create RFC 7807 problem details for APIs.\n\n\n## Usage\n\nTo configute the mandatory services for the problem details middleware just execute\n```AddProblemDetails``` on the ```IMvcBuilder``` instance in your startup code.\n\n```C#\nWebApplicationBuilder builder = WebApplication.CreateBuilder(args);\n\n// Add services to the container.\nbuilder.Services\n\t.AddControllers()\n\t.AddProblemDetails(options =\u003e\n\t{\n\t\t// Only include exception details in a development environment. This is the default\n\t\t// behavior and is included to demo purposes.\n\t\toptions.IncludeExceptionDetails = (context, exception) =\u003e builder.Environment.IsDevelopment();\n\n\t\t// Use the status code 501 for this type of exception.\n\t\toptions.MapStatusCode\u003cNotImplementedException\u003e(HttpStatusCode.NotImplemented);\n\n\t\t// Use the status code 501 for this type of exception.\n\t\toptions.MapStatusCode\u003cInvalidOperationException\u003e(HttpStatusCode.InternalServerError);\n\n\t\t// Add a fallback for all other exceptions with the status code 500.\n\t\toptions.MapStatusCode\u003cException\u003e(HttpStatusCode.InternalServerError);\n\t});\n```\n\nAfter you've built your web application instance add the middlware to the pipeline by\ncalling ```UseProblemDetails```.\n\n```C#\nWebApplication app = builder.Build();\n\n// Configure the HTTP request pipeline.\t\t\t\napp.UseCors();\napp.UseProblemDetails();\napp.UseHttpsRedirection();\napp.UseAuthorization();\napp.MapControllers();\napp.Run();\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgernand%2Faspnetcore.problemdetails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmgernand%2Faspnetcore.problemdetails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgernand%2Faspnetcore.problemdetails/lists"}