apache / apache/grails-core

Provide a way to unit test controller redirects unaware of url mappings

Open
#9,372 1 comment 0 reactions 0 assignees View on GitHub
type: enhancement
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

In Grails 3.x, currently we can acess response.redirectedUrl in a unit test to check for a controller redirection, but the returned url is affected by url mappings, which one may feel unconfortable with while testing the controller

Instead we could have something like controller.redirectArgs which would return a map with the exact arguments (unaffected by url mappings) that were used inside the controller to do the redirection

Contributor guide

Open the contributing guide

Research direction

Start by examining Grails 3.x controller unit-test redirect handling, especially how response.redirectedUrl is produced and affected by URL mappings. Define the redirect arguments exposed by the proposed controller.redirectArgs API, then add unit coverage showing they remain unchanged by URL mappings.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.