Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lor6 committed Mar 12, 2017
1 parent f72f053 commit dde12c8
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
Expand All @@ -19,13 +20,13 @@ public class EmployeeController {

private List<Employee> employees = new ArrayList<>();

@RequestMapping(value = "/employee")
@GetMapping("/employee")
@ResponseBody
public Employee getEmployee(@RequestParam String email) {
return employees.stream().filter(x -> x.getEmail().equals(email)).findAny().orElse(null);
}

@RequestMapping(value = "/employee", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@PostMapping(value = "/employee", consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.CREATED)
public void postMessage(@RequestBody Employee employee) {
employees.add(employee);
Expand Down

0 comments on commit dde12c8

Please sign in to comment.