@@ -526,38 +526,39 @@ class KickApi {
526526 body: [ String : Any ] ? = nil ,
527527 onComplete: @escaping ( OperationResult ) -> Void )
528528 {
529- doRequest ( method: method, subPath: " v2/ \( subPath) " , body: body, onComplete: onComplete)
529+ guard let url = URL ( string: " https://kick.com/api/v2/ \( subPath) " ) else {
530+ return
531+ }
532+ doRequest ( url: url, method: method, body: body, onComplete: onComplete)
530533 }
531534
532535 private func doInternalV1Request( method: String ,
533536 subPath: String ,
534537 body: [ String : Any ] ? = nil ,
535538 onComplete: @escaping ( OperationResult ) -> Void )
536539 {
537- doRequest ( method: method, subPath: " internal/v1/ \( subPath) " , body: body, onComplete: onComplete)
540+ guard let url = URL ( string: " https://kick.com/api/internal/v1/ \( subPath) " ) else {
541+ return
542+ }
543+ doRequest ( url: url, method: method, body: body, onComplete: onComplete)
538544 }
539545
540546 private func doWebV1Request( method: String ,
541547 subPath: String ,
542548 body: [ String : Any ] ? = nil ,
543549 onComplete: @escaping ( OperationResult ) -> Void )
544550 {
545- doRequest ( method: method,
546- subPath: " v1/ \( subPath) " ,
547- body: body,
548- baseUrl: " https://web.kick.com/api/ " ,
549- onComplete: onComplete)
551+ guard let url = URL ( string: " https://web.kick.com/api/v1/ \( subPath) " ) else {
552+ return
553+ }
554+ doRequest ( url: url, method: method, body: body, onComplete: onComplete)
550555 }
551556
552- private func doRequest( method : String ,
553- subPath : String ,
557+ private func doRequest( url : URL ,
558+ method : String ,
554559 body: [ String : Any ] ? = nil ,
555- baseUrl: String = " https://kick.com/api/ " ,
556560 onComplete: @escaping ( OperationResult ) -> Void )
557561 {
558- guard let url = URL ( string: " \( baseUrl) \( subPath) " ) else {
559- return
560- }
561562 var request = URLRequest ( url: url)
562563 request. httpMethod = method
563564 request. setContentType ( " application/json " )
0 commit comments