Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom mapping from errors to views #23

Merged
merged 5 commits into from
Jul 2, 2022
Merged

Add custom mapping from errors to views #23

merged 5 commits into from
Jul 2, 2022

Conversation

dannflor
Copy link
Contributor

Adds an optional parameter to init as well as the LeafMiddlewareDefaultGenerator to provide a custom set of mappings of HTTPStatus to .leaf template names. Does not break the public API. I did this because it didn't make sense to get a 503 page when someone messes up their password.

@codecov
Copy link

codecov bot commented Jun 28, 2022

Codecov Report

Merging #23 (16f05a1) into main (2f707d0) will increase coverage by 0.21%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #23      +/-   ##
==========================================
+ Coverage   96.61%   96.82%   +0.21%     
==========================================
  Files           2        2              
  Lines          59       63       +4     
==========================================
+ Hits           57       61       +4     
  Misses          2        2              
Impacted Files Coverage Δ
...rces/LeafErrorMiddleware/LeafErrorMiddleware.swift 96.00% <100.00%> (+0.08%) ⬆️
...ddleware/LeafErrorMiddlewareDefaultGenerator.swift 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2f707d0...16f05a1. Read the comment docs.

Copy link
Member

@0xTim 0xTim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whilst we can argue the merits of returning a 401 page instead of using the redirect middleware I think this PR has some useful features in. Some requested changes around the tests then we're good

@dannflor
Copy link
Contributor Author

dannflor commented Jul 1, 2022

@0xTim Bump. Wanna start using these features in my projects 😛

Copy link
Member

@0xTim 0xTim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@0xTim 0xTim merged commit 272cc7b into brokenhandsio:main Jul 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants