Skip to content

Commit

Permalink
feat: cors 설정 및 requestBody -> requestParam
Browse files Browse the repository at this point in the history
  • Loading branch information
osoohynn committed Dec 1, 2024
1 parent 5b4c062 commit 37f4b2e
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,23 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.UUID;


@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/api")
@CrossOrigin(origins = "*")
public class ChatGPTController {

private final ChatGPTService chatGPTService;
Expand All @@ -37,8 +41,8 @@ public ResponseEntity<MessageDto> refresh(@RequestBody RefreshRequest request) {
return new ResponseEntity<>(result, HttpStatus.OK);
}

@GetMapping()
public ResponseEntity<List<String>> getAnswers(@RequestBody RefreshRequest request) {
return new ResponseEntity<>(chatGPTService.getAnswers(request.userId()), HttpStatus.OK);
@GetMapping
public ResponseEntity<List<String>> getAnswers(@RequestParam UUID userId) {
return new ResponseEntity<>(chatGPTService.getAnswers(userId), HttpStatus.OK);
}
}

0 comments on commit 37f4b2e

Please sign in to comment.