 
     //Adapted from https://gist.github.com/erica/baa8a187a5b4796dab27
     internal func synchronusRequest(_ endpoint: Endpoint, parameters: [String: Any?]) -> [String: Any]? {
-        var components = URLComponents(string: "\(apiUrl)\(endpoint.rawValue)")
-        if parameters.count > 0 {
-            components?.queryItems = filterNilParameters(parameters).map { URLQueryItem(name: $0.0, value: "\($0.1)") }
-        }
-        guard let url = components?.url else {
+        guard let url = self.url(for: endpoint, parameters: parameters) else {
             return nil
         }
         let request = URLRequest(url: url)

        parameters: [String: Any?],
        successClosure: @escaping ([String: Any]) -> Void, errorClosure: @escaping (SlackError) -> Void
    ) {
        var components = URLComponents(string: "\(apiUrl)\(Endpoint.filesUpload.rawValue)")
        if parameters.count > 0 {
            components?.queryItems = filterNilParameters(parameters).map { URLQueryItem(name: $0.0, value: "\($0.1)") }
        }
        guard
            let url = components?.url,
            let filename = parameters["filename"] as? String,
            let filetype = parameters["filetype"] as? String
        else {

        successClosure: @escaping ([String: Any]) -> Void,
        errorClosure: @escaping (SlackError) -> Void
    ) {
        guard let url = self.url(for: endpoint, parameters: parameters) else {
            errorClosure(SlackError.clientNetworkError)
            return
        }
