Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

박스오피스 [Step2-3] Toy,Morgan #123

Open
wants to merge 8 commits into
base: ic_10_morgan
Choose a base branch
from

Conversation

devjoon
Copy link

@devjoon devjoon commented Dec 12, 2023

@havilog
하비 endpoint 작업하여 다시 PR 보냅니다!

//
import Foundation

struct Endpoint {
Copy link

Choose a reason for hiding this comment

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

endpoint를 struct로 하는 것은 구현 취향의 문제일거 같은데,
movie 관련된 endpoint들,
home 관련된 endpoint들,
setting 관련된 endpoint들
등 이런식으로 나눠지고
각각의 엔드포인트에 대한 케이스가 정의되는 곳이 필요할 것 같아요
지금은 뷰컨쪽에서 일일히 다 넣어주고 있는데
메소드나 헤더 같은 경우는 이미 정의되어있어서
파라미터만 다이나믹하게 넣어주면 될 것 같아요

또한 파라미터를 인코딩하는 로직이 빠져있는데 이 부분도 챙겨주세요

그리고 마임같은 경우도 꼭 파라미터로 받아야할지 의문이긴 해요
꼭 받아야한다 라는 의미는
디폴트 밸류를 주거나 옵셔널이어도 되지 않을까 싶어요

Copy link

@havilog havilog left a comment

Choose a reason for hiding this comment

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

혹시 저번에 말씀드린
알라모파이어까지는 아니더라도 다른 사람들이 미리 짜본 네트워크 깃헙들은
한 번 다 찾아보시고 작성하신 코드일까요?

제가 느끼기에는 코드에 대한 고민을 많이 하시기 보다는
배경에 대한 지식 공부 없이 구현만 조금씩 바꿔가시는 느낌이 드는데요,
이러한 리뷰는 의미가 많이 퇴색된다고 느껴지네요

혹시 토이와 모건이 네트워크에 대한 수정을 여기서 마무리하고 피쳐 구현을 하고 싶으시다면 결정하셔서 알려주시면 좋을 것 같습니다~!

}

guard let httpResponse = response as? HTTPURLResponse, (200...299).contains(httpResponse.statusCode) else {
print(NetworkManagerError.responseError)
Copy link

Choose a reason for hiding this comment

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

여기서 에러처리는 왜 포기하신 걸까요??

Copy link
Author

Choose a reason for hiding this comment

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

complitionHandler 이용하여 에러처리 하였습니다!

Comment on lines 34 to 43
func asURLPostRequset(data: Data) throws -> URLRequest {
guard let url = api.getURL(apikey: Key.movieDataApiKey, queryItems: queryItems) else { throw URLError.invalidURL }

var request = URLRequest(url: url)
request.httpMethod = httpMethod.rawValue
request.addValue(mime.rawValue, forHTTPHeaderField: httpHeaderField.rawValue)
request.httpBody = data

return request
}
Copy link

Choose a reason for hiding this comment

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

파라미터 인코딩에 대한 내용은 여전히 빠져있는거 같은데 이 부분도 수정이 되는 부분일까요?

Choose a reason for hiding this comment

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

url 을 getURL 메서드를 통해서 만들어주고 NetworkManager에서 인코딩 된 데이터를 asURLPostRequest 메서드의 파라미터에 넣어 네트워킹을 하고 있습니다. 인코딩 자체를 asURLPostRequest 메서드 내부에서 해야한다는 말씀이신지 궁금합니다!

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.

None yet

3 participants