Skip to content

Commit

Permalink
Slashes(/) removed from root mappings to be able accept the requests …
Browse files Browse the repository at this point in the history
…both with `/` and without `/`.
  • Loading branch information
mikailcolak committed Oct 1, 2020
1 parent 70b7f55 commit 7695641
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public CompanyController(
this.assembler = assembler;
}

@GetMapping("/")
@GetMapping
public CollectionModel<EntityModel<Company>> all(Pageable pageable) {

var companies = repository
Expand All @@ -45,7 +45,7 @@ public CollectionModel<EntityModel<Company>> all(Pageable pageable) {
return PagedModel.of(companies, linkTo(methodOn(CompanyController.class).all(pageable)).withSelfRel());
}

@PostMapping("/")
@PostMapping
public ResponseEntity<?> newCompany(@RequestBody Company newCompany) {

var entityModel = assembler.toModel(repository.save(newCompany));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public EmployeeController(
this.assembler = assembler;
}

@GetMapping("/")
@GetMapping
public CollectionModel<EntityModel<Employee>> all(Pageable pageable) {

var employees = repository
Expand All @@ -57,7 +57,7 @@ public CollectionModel<EntityModel<Employee>> allByCompanyId(@PathVariable Long
return CollectionModel.of(employees, linkTo(methodOn(EmployeeController.class).all(Pageable.unpaged())).withSelfRel());
}

@PostMapping("/")
@PostMapping
public ResponseEntity<?> newEmployee(@RequestBody Employee newEmployee) {

var entityModel = assembler.toModel(repository.save(newEmployee));
Expand Down

0 comments on commit 7695641

Please sign in to comment.