Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public class LiveblocksClient {
@Value("${liveblocks.secret-key}")
private String secretKey;

private static final String LIVEBLOCKS_API_URL = "https://api.liveblocks.io/v2/rooms?idempotent";
private static final String LIVEBLOCKS_API_URL = "https://api.liveblocks.io/v2/rooms";
private static final String LIVEBLOCKS_QUERY_STRING = "?idempotent";
private static final String AUTH_API_URL = "https://api.liveblocks.io/v2/authorize-user";

/**
Expand All @@ -46,7 +47,7 @@ public void createRoom(String roomId) {

try {
// 4. Liveblocks API에 POST 요청 전송
ResponseEntity<String> response = restTemplate.postForEntity(LIVEBLOCKS_API_URL, requestEntity, String.class);
ResponseEntity<String> response = restTemplate.postForEntity(LIVEBLOCKS_API_URL + LIVEBLOCKS_QUERY_STRING, requestEntity, String.class);

if (response.getStatusCode().is2xxSuccessful()) {
log.info("Liveblocks room created successfully. roomId: {}", roomId);
Expand All @@ -66,7 +67,7 @@ public void createRoom(String roomId) {
* @param roomId 삭제할 방의 고유 ID
*/
public void deleteRoom(String roomId) {
String deleteUrl = LIVEBLOCKS_API_URL + "/" + roomId;
String deleteUrl = LIVEBLOCKS_API_URL + "/" + roomId + LIVEBLOCKS_QUERY_STRING;
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider using a StringBuilder or String.format() for URL construction to improve readability and maintainability, especially as URLs become more complex.

Suggested change
String deleteUrl = LIVEBLOCKS_API_URL + "/" + roomId + LIVEBLOCKS_QUERY_STRING;
String deleteUrl = String.format("%s/%s%s", LIVEBLOCKS_API_URL, roomId, LIVEBLOCKS_QUERY_STRING);

Copilot uses AI. Check for mistakes.
HttpHeaders headers = new HttpHeaders();
headers.setBearerAuth(secretKey);
HttpEntity<Void> requestEntity = new HttpEntity<>(headers);
Expand Down