Repository navigation
fix(routing): render /affiliations and route 404 via worker template engine - #89
Open
tarunagnihotri534 wants to merge 1 commit into
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #88
Problem
wrangler.toml,run_worker_firstwas missing"/affiliations".src/worker.py,STATIC_CLEAN_ROUTESwas missing"/affiliations": "/affiliations.html"./affiliationsbypassed worker template rendering and directly returned the unrendered static template file containing{% extends "base.html" %}.wrangler.toml,not_found_handling = "404-page"caused Cloudflare Assets to directly return staticpublic/404.htmlwithout running worker rendering logic.src/worker.py,render_404()rendered template tags but did not inline<div id="site-navbar"></div>and<div id="site-footer"></div>partials.Fix
wrangler.toml:"/affiliations"torun_worker_first.not_found_handling = "none"so unknown routes fall through to the Worker dispatcher to be rendered byrender_404().src/worker.py:"/affiliations": "/affiliations.html"toSTATIC_CLEAN_ROUTES.render_404()to provide full consistent styling on error pages.tests/test_dispatcher.py:test_affiliations_clean_route_serves_page()verifying/affiliationsresolves and serves 200.test_missing_file_renders_404_template_without_raw_tags()verifying 404 responses render template tags properly.Verification
python -m py_compile src/worker.py(clean exit, code 0).pytest tests/test_dispatcher.py -k TestStaticFileServing(6/6 tests passed).npx wrangler deploy --dry-run(76 assets read, bundled successfully, exit code 0).