Skip to content
rebus-orgPublic

About

🎎 Random AspNetCore middlewares

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

14 Commits

Folders and files

Repository files navigation

Unawares

Just some AspNetCore middlewares.

Currently there's only one.

Exception Mapper

Go

app.UseExceptionMapper(
	builder => builder
		.Map<ArgumentException>(HttpStatusCode.BadRequest)
		.Map<EntityNotFoundException>(HttpStatusCode.NotFound)
		.Map<Exception>(
			status: HttpStatusCode.InternalServerError, 
			criteria: exception => exception.Message.StartsWith("oh no!")
		)
);

to map some exceptions to some HTTP status codes.

Please register it BEFORE your web app so it can catch its exceptions:

app.UseExceptionMapper(...);

// (...)

app.UseEndpoints(...);

Landing Page redirector

It's just

app.UseLandingPage("swagger");

to redirect (HTTP 302) to e.g. the swagger UI.

About

🎎 Random AspNetCore middlewares

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages