XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Done
    • Icon: Medium Medium
    • None
    • None
    • None
    • None

      Method breaks a rule: only one type of response. It returns two different values. Depends on some condition.

      @GetMapping("get/

      {templateName}

      ")
      public ResponseEntity<?> get(@PathVariable String templateName) {
      Optional<Template> template = service.get(templateName);
      if (!template.isPresent())

      { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.TEXT_PLAIN); return new ResponseEntity<>(TEMPLATE_NOT_FOUND_MSG, headers, HttpStatus.NOT_FOUND); }

      return new ResponseEntity<>(template, HttpStatus.OK);
      }

            bartoszg bartoszg
            bogumil_zebek bogumil_zebek
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: