Skip to content

Update shipped module templates to use the new response redirect API #541

Description

@armanist

Summary

Update shipped module templates so redirect behavior uses the new response redirect API introduced by #540 instead of older helper-first redirect patterns.

This should cover generated controllers and middlewares in the shipped templates that currently emit redirect helper usage, primarily DemoWeb and Toolkit.

Why

Current generated module code still uses older redirect helper patterns such as:

  • redirect(base_url(...) . '...')
  • redirect(get_referrer() ?? base_url())
  • redirectWith(...)

These patterns are repeated across generated controllers and middlewares in the current shipped templates.

Once #540 introduces first-class back-navigation support and a cleaner response-level redirect API, generated scaffolding should reflect that preferred direction instead of continuing to emit older helper-style usage.

Goal

Align shipped module scaffolding with the newer response redirect API so new generated code reflects the preferred redirect style.

Scope

This ticket should update shipped templates that currently emit redirect helper usage, primarily:

  • DemoWeb
  • Toolkit

This should cover generated controllers and middlewares where redirect behavior is currently expressed through older helper-first patterns.

Proposed Direction

  • replace older helper-first redirect patterns in shipped templates with the new response redirect API introduced by #540
  • use first-class back-navigation support where existing templates currently repeat get_referrer() ?? base_url() logic
  • keep the generated redirect code consistent across affected shipped templates

Examples of current patterns to replace include:

  • redirect(base_url(...) . '...')
  • redirect(get_referrer() ?? base_url())
  • redirectWith(...)

Acceptance Criteria

  • shipped module templates no longer emit repeated manual referrer fallback patterns
  • generated controllers and middlewares use the preferred response redirect API introduced by #540
  • redirect-related generated code is consistent across affected shipped templates
  • generated old-input redirect behavior remains coherent with the updated redirect API
  • templates remain functionally equivalent after the redirect API update

Notes

Relevant code includes:

  • src/Module/Templates/DemoWeb
  • src/Module/Templates/Toolkit

Depends on:

  • #540

Metadata

Metadata

Assignees

No one assigned

    Labels

    httpHTTP transport, redirects, and request/response behaviortemplatesShipped templates and scaffolding

    Type

    No fields configured for Task.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions