Skip to content

Conversation

@unifolio0
Copy link

안녕하세요 이상! 비토입니다!
어느 정도 클래스 분리를 하긴했는데 아직 군데군데 리팩토링이 필요하긴 합니다.

천천히 리뷰 주세요.
리뷰 잘 부탁드립니다!

Copy link

@kunsanglee kunsanglee left a comment

Choose a reason for hiding this comment

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

비토! 굉장히 깔끔하게 작성해주셨네요.
코드를 읽는데 매우 편했어요 💯
간단히 코멘트 남겼으니 반영해주세요.
고생 많으셨어요! 😇

Comment on lines +31 to +33
String fileName = "static" + path;
var resourceUrl = getClass().getClassLoader().getResource(fileName);
Path filePath = Path.of(resourceUrl.toURI());

Choose a reason for hiding this comment

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

존재하지 않는 경로에 대한 처리가 없어서 NullPointerException 발생합니다.

Comment on lines +29 to +32
String requestBody = httpRequest.getBody();
String[] token = requestBody.split("&");
String account = token[0].split("=")[1];
String password = token[1].split("=")[1];

Choose a reason for hiding this comment

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

로그인 페이지에서 input 값을 완전히 채우지 않고 POST 요청을 보내면 ArrayIndexOutOfBoundsException 예외가 발생합니다.

Comment on lines +21 to +25
String requestBody = httpRequest.getBody();
String[] token = requestBody.split("&");
String account = token[0].split("=")[1];
String email = token[1].split("=")[1];
String password = token[2].split("=")[1];

Choose a reason for hiding this comment

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

회원가입 페이지에서 input 값을 완전히 채우지 않고 POST 요청을 보내면 ArrayIndexOutOfBoundsException 예외가 발생합니다.

Comment on lines +26 to +27
User user = new User(account, password, email);
InMemoryUserRepository.save(user);

Choose a reason for hiding this comment

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

중복 회원가입이 가능한 상태입니다.

public RequestMapping() {
controllers.put("/login", new LoginController());
controllers.put("/register", new RegisterController());
controllers.put("page", new PageController());

Choose a reason for hiding this comment

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

로그인, 회원가입 페이지가 아니면 PageController를 반환하고 있어서 controllerspage를 넣을 필요가 없을 것 같네요.

Comment on lines +28 to +39
Map<String, String> headers = httpResponseHeader.getHeaders();
StringBuilder sb = new StringBuilder();
int size = headers.keySet().size();
int i = 1;
for (String key : headers.keySet()) {
if (i < size) {
sb.append(key).append(": ").append(headers.get(key)).append(" \r\n");
size++;
} else {
sb.append(key).append(": ").append(headers.get(key));
}
}

Choose a reason for hiding this comment

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

HttpResponseHeader 객체에게 responseHeader를 요청하는게 어떨까요?

Comment on lines +59 to +65
String[] cookies = httpRequest.getValue("Cookie").split("; ");
String cookie = "";
for (String c : cookies) {
if (c.contains("JSESSIONID")) {
cookie = c.split("=")[1];
}
}

Choose a reason for hiding this comment

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

어느 미친 사용자가 비토가 넣어준 JSESSIONID 값을 지우고 로그인 페이지로 접근했더니ArrayIndexOutOfBoundsException예외가 발생했다네요.

Comment on lines +27 to +30
String path = httpRequest.getPath();
if (!httpRequest.getPath().contains(".")) {
path += ".html";
}

Choose a reason for hiding this comment

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

어느 미친 사용자가 서버 내부 에러를 발생시켰는데, 그 요청은 localhost:8080/500 이었어요.

;

private final String contentType;
private final String extention;

Choose a reason for hiding this comment

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

extension!

@kunsanglee kunsanglee self-requested a review September 6, 2024 13:42
@kunsanglee kunsanglee merged commit 9ca95ad into woowacourse:unifolio0 Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants