fix(laravel): use route URI instead of unnamed_route in resource name#3761
Merged
fix(laravel): use route URI instead of unnamed_route in resource name#3761
Conversation
Contributor
Snapshots difference summaryThe following differences have been observed in committed snapshots. It is meant to help the reviewer. If you need to update snapshots, please refer to CONTRIBUTING.md 9 occurrences of : - "resource": "App\\Http\\Controllers\\CommonSpecsController@error unnamed_route"
+ "resource": "App\\Http\\Controllers\\CommonSpecsController@error error"
7 occurrences of : - "resource": "App\\Http\\Controllers\\CommonSpecsController@simple_view unnamed_route"
+ "resource": "App\\Http\\Controllers\\CommonSpecsController@simple_view simple_view"
3 occurrences of : - "resource": "App\\Http\\Controllers\\CommonSpecsController@dynamicRoute unnamed_route"
+ "resource": "App\\Http\\Controllers\\CommonSpecsController@dynamicRoute dynamic_route/{param01}/static/{param02?}"
|
|
✨ Fix all issues with BitsAI or with Cursor
|
e796c0c to
f286f9c
Compare
When DD_HTTP_SERVER_ROUTE_BASED_NAMING is enabled (default), routes
defined without a ->name() call produced resources like:
App\Http\Controllers\FooController@bar unnamed_route
This was unhelpful and inconsistent with named routes. For unnamed
routes, fall back to `{HTTP_METHOD} {route_uri}` (e.g. `GET error`),
which matches the format customers already see for named routes and
gives a meaningful, actionable resource name.
Named routes are unaffected.
Fixes APMS-18982
f286f9c to
4f6a72b
Compare
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.
Summary
When
DD_HTTP_SERVER_ROUTE_BASED_NAMINGis enabled (default), routes defined without a->name()call produced resource names like:For unnamed routes, the
unnamed_routesuffix is now replaced with the actual route URI:Named routes are fully unaffected.
Fixes APMS-18982.
Root cause
LaravelIntegration::findRoutesets the resource to{action} {routeName}. For routes defined with the old string syntax (Route::get('path', 'Controller@method')) or any route without->name(),normalizeRouteName()returns the constant'unnamed_route'. There was no fallback — the literal string ended up in the resource.