Skip to content
This repository was archived by the owner on Dec 8, 2018. It is now read-only.

UseDeveloperExceptionJson middelware #477

Closed
peirens-bart opened this issue Sep 2, 2018 · 1 comment
Closed

UseDeveloperExceptionJson middelware #477

peirens-bart opened this issue Sep 2, 2018 · 1 comment

Comments

@peirens-bart
Copy link

I would like to propose a new feature for this libary, UseDeveloperExceptionJson(). A middelware that is doeing the same thing as UseDevelopeExceptionPage() but returns Json.

I think the extension needs a routing filter so the middleware can deside what to return. this would be handy when creating an SPA where the api calls would return json. Now I got html in the F12 tools when I have an exception during development. I know that Unit Testing must solve most of the exception, but what if you forget the register a dependency. Finding the reason in the F12 tools when the return body is html is not so handy. As for now I have my own middleware that is doing something like that, but it can be handy as it was in the same namespace and assembly.

the Configure method can do something like:

if (env.IsDevelopment()) { app.UseDeveloperExceptionJson("*/api/*"); app.UseDeveloperExceptionPage(); }

@Tratcher
Copy link
Member

Tratcher commented Sep 2, 2018

Duplicate of dotnet/aspnetcore#2573

@Tratcher Tratcher marked this as a duplicate of dotnet/aspnetcore#2573 Sep 2, 2018
@Tratcher Tratcher closed this as completed Sep 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants