Skip to content

Commit 6f2196c

Browse files
committed
feat: get, post 호출 시 httpMethod를 변경하도록 함 (#4)
1 parent db33543 commit 6f2196c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Client/iOS/TodoList/Network/CardHTTPRequest.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class CardHTTPRequest: SessionConfiguration {
2020
/// - completionHandler: 요청 후 Data객체를 (혹은 nil인) 호출하는 클로저입니다.
2121
func doGetRequest(url: URL, parameter: [String:String]?, completionHandler: @escaping (Data?)->Void) {
2222

23+
httpMethod = .GET
24+
2325
guard let urlComp = getURLComponents(parameter) else {
2426
completionHandler(nil)
2527
return
@@ -47,6 +49,8 @@ class CardHTTPRequest: SessionConfiguration {
4749
/// - completionHandler: 요청 후 Data객체를 (혹은 nil인) 호출하는 클로저입니다.
4850
func doGetRequest(parameter: [String:String]?, completionHandler: @escaping (Data?)->Void) {
4951

52+
httpMethod = .GET
53+
5054
guard let urlComp = getURLComponents(from: urlString, parameter) else {
5155
completionHandler(nil)
5256
return
@@ -100,6 +104,9 @@ class CardHTTPRequest: SessionConfiguration {
100104
/// - parameter: Request body에 보낼 이진 데이터(Data 구조체)입니다.
101105
/// - completionHandler: 요청 후 Data객체를 (혹은 nil인) 호출하는 클로저입니다.
102106
func doPostRequest(url: URL, _ paramData: Data? = nil, completionHandler: @escaping (Data?)->Void) {
107+
108+
httpMethod = .POST
109+
103110
getRequestHandler(url: url) { request in
104111
self.session.uploadTask(with: request, from: paramData) { data, response, error in
105112
guard let data = data else {
@@ -117,6 +124,9 @@ class CardHTTPRequest: SessionConfiguration {
117124
/// - parameter: Request body에 보낼 이진 데이터(Data 구조체)입니다.
118125
/// - completionHandler: 요청 후 Data객체를 (혹은 nil인) 호출하는 클로저입니다.
119126
func doPostRequest(_ paramData: Data? = nil, completionHandler: @escaping (Data?)->Void) {
127+
128+
httpMethod = .POST
129+
120130
getCurrentRequestHandler { request in
121131
self.session.uploadTask(with: request, from: paramData) { data, response, error in
122132
guard let data = data else {

0 commit comments

Comments
 (0)