spring-projects / spring-projects/spring-hateoas
Unable to expand() template link #169
@odrotbohm is already working on this.
Since Mar 1, 2017.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 476
- PR merge metrics
- No merged PRs in 30d
Description
Given
ControllerLinkBuilderFactory linkBuilderFactory = new ControllerLinkBuilderFactory();
linkBuilderFactory.setUriComponentsContributors(singletonList(new HateoasPageableHandlerMethodArgumentResolver()));
@GetMapping("/deals")
CollectionResource<DealResource> findDeals(
@RequestParam(required = false) String title,
@RequestParam(value = "category_id", required = false) Long categoryId,
@RequestParam(value = "tags[]", required = false) String[] tags,
@PageableDefault(sort = "position", direction = ASC) Pageable pageable)
When:
Link next = linkBuilderFactory.linkTo(methodOn(MobileVoucherDealsController.class)
.findDeals(title, categoryId, tags, pageable.next())).withRel("next");
Then:
Link: http://localhost:8080/deals?page=1&size=1&sort=position,asc{&title,category_id,tags[]}
When:
From #535
Just expand the
Linkwithout handing any parameters into the method and you should get a plain URI in turn.
next.expand(TemplateVariables.NONE);
Then:
Illegal character in query at index 59: http://localhost:8080/deals?page=1&size=1&sort=position,asc{&title,category_id,tags[]}
I tried expanding links in the same manner like http://localhost:8080/deals{/id} and it works resulting in http://localhost:8080/deals but not with template being after URL request params
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.