Skip to content

AnnotationMappingDiscoverer does not preserve trailing mapping slashes #1468

@nealeu

Description

@nealeu

In #269 the following problem is raised and never resolved:

Using linkTo(methodOn()) to reference an endpoint with a trailing slash removes the trailing slash.

@RequestMapping("/api/myentities/")

result: http://localhost:6010/api/myentities

This is an obvious situation where there is either a bug (the trailing slash should not be removed), or there is something opinionated going on (e.g. HATEOAS links should never end in /).

If not a bug, then a developers code is always going to break and then have messy workarounds, therefore Spring HATEOAS should be clear.

I suggest that if this is the case, then it would make most sense to throw IllegalArgumentException with an appropriate comment that the trailing slash should be removed (this is safe because the endpoint will still be resolved correctly if a trailing slash is added to a request - but not the reverse)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions