Closed
Description
I use Spring HATEOAS 1.3.4.
Given:
@Controller
@RequestMapping("/foo")
public class MyController {
@GetMapping
public ResponseEntity<?> get() {
return ResponseEntity.ok(
new RepresentationModel<>(
linkTo(methodOn(MyController.class).get())
.withSelfRel()
.andAffordance(afford(methodOn(MyController.class).uploadFile(null)))
)
);
}
@PostMapping(value = "/file", consumes = "multipart/form-data")
public ResponseEntity<?> uploadFile(@RequestParam("file") MultipartFile file) {
return ResponseEntity.noContent().build();
}
}
Performing:
GET http://localhost:8080/foo/
Produces:
{
"_links": {
"self": {
"href": "http://localhost:8080/api/foo"
}
},
"_templates": {
"default": {
"method": "put",
"contentType": "multipart/form-data",
"properties": [],
"target": "http://localhost:8080/api/foo/file?file={file}"
}
}
}
As you can see, the target
property is not valid because of file
parameter.