Skip to content

feat: add 405 method not allowed error handler - #327

Merged
komalharshita merged 1 commit into
komalharshita:mainfrom
rudra3007-pro:feat/405-error-handler
May 19, 2026
Merged

feat: add 405 method not allowed error handler#327
komalharshita merged 1 commit into
komalharshita:mainfrom
rudra3007-pro:feat/405-error-handler

Conversation

@rudra3007-pro

@rudra3007-pro rudra3007-pro commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Added a 405 Method Not Allowed error handler to match the existing 404
and 500 handlers in app.py. Also added a styled templates/405.html
page consistent with the rest of the error pages in the app.

Related Issue

Closes #326

Type of Change

  • Feature — adds new functionality

What Was Changed

File Change made
app.py Added method_not_allowed error handler for 405
templates/405.html Added styled 405 error page

How to Test This PR

  1. Clone this branch: git checkout feat/405-error-handler
  2. Install dependencies: pip install -r requirements.txt
  3. Run the app: python app.py
  4. In terminal run:
    curl -X GET http://127.0.0.1:5000/api/recommend
  5. You should see the styled 405 page instead of a raw Flask error

Self-Review Checklist

  • I have read CONTRIBUTING.md and followed all guidelines
  • My branch name follows the convention: feat/405-error-handler
  • I have run python tests/test_basic.py and all tests pass
  • I have run flake8 . locally and there are no errors
  • I have not introduced any print() debug statements
  • Every new function I wrote has a docstring
  • I have not modified files outside the scope of the linked issue

Notes for Reviewer

Follows the exact same pattern as the existing 404 and 500 handlers.
The 405.html template reuses the same CSS classes as 404.html.

@vercel

vercel Bot commented May 19, 2026

Copy link
Copy Markdown

@rudra3007-pro is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel.

A member of the Team first needs to authorize it.

@komalharshita komalharshita left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Good contribution overall. The dedicated 405 error handler is implemented cleanly and follows the existing application error-handling pattern well.

The custom template improves user experience compared to the default Flask response, and the PR stays properly scoped without introducing unrelated modifications. Reusing the shared styling system also keeps the implementation consistent with the rest of the project.

Minor non-blocking suggestion: consider moving the inline button styles into the shared stylesheet for better maintainability in future iterations.

Approved for merge.

@komalharshita
komalharshita merged commit 61b5bf7 into komalharshita:main May 19, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add 405 Method Not Allowed error handler

2 participants