We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
According to the documentation for @RequestParam the value property acts as an alias for the name property.
@RequestParam
Unfortunately there is an inconstant behavior when generating links by using the name property.
Here is my dummy controller:
@Controller public class MyController { @GetMapping("/foo") public ResponseEntity<String> methodWithRequestParamNamedByValue(@RequestParam(value="age") int a){ return null; } @GetMapping("/foo") public ResponseEntity<String> methodWithRequestParamNamedByName(@RequestParam(name="age") int a){ return null; } }
And here is the test to this controller:
public class MyControllerTest { @Before public void setUp() { ServletRequestAttributes requestAttributes = new ServletRequestAttributes(new MockHttpServletRequest()); RequestContextHolder.setRequestAttributes(requestAttributes); } @Test public void methodWithRequestParamNamedByValue() throws Exception { Link link = linkTo(methodOn(MyController.class).methodWithRequestParamNamedByValue(1)).withSelfRel(); assertThat(link.getHref(), is("http://localhost/foo?age=1")); } // FAILING with "http://localhost/foo?a=1" @Test public void methodWithRequestParamNamedByName() throws Exception { Link link = linkTo(methodOn(MyController.class).methodWithRequestParamNamedByName(1)).withSelfRel(); assertThat(link.getHref(), is("http://localhost/foo?age=1")); } }
The text was updated successfully, but these errors were encountered:
Which version are you using, I think we fixed something in the alias detection in the recently released 0.24.
Sorry, something went wrong.
Hi @olivergierke, we are using spring-boot 1.5.8.RELEASE's version of spring-hateoas, which is 0.23.0.RELEASE.
The bug is fixed in 0.24.RELEASE. Thanks for that.
We will waiting for the alignment with spring boot.
rather late than never :)
We're currently on spring-hateoas 1.1.3 and there is no problems with this issue.
Can be closed!
Thanks!
odrotbohm
No branches or pull requests
According to the documentation for
@RequestParam
the value property acts as an alias for the name property.Unfortunately there is an inconstant behavior when generating links by using the name property.
Here is my dummy controller:
And here is the test to this controller:
The text was updated successfully, but these errors were encountered: