Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #17 from muratayusuke/bugfix/ignore_int_param
Browse files Browse the repository at this point in the history
Bugfix: Do not ignore Int and Bool parameters when making requests to the web api
  • Loading branch information
pvzig committed Mar 1, 2016
2 parents 3efe575 + 64440b5 commit 319dc9a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions SlackKit/Sources/NetworkInterface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ internal struct NetworkInterface {
internal func request(endpoint: SlackAPIEndpoint, token: String, parameters: [String: AnyObject]?, successClosure: ([String: AnyObject])->Void, errorClosure: (SlackError)->Void) {
var requestString = "\(apiUrl)\(endpoint.rawValue)?token=\(token)"
if let params = parameters {
requestString = requestString + requestStringFromParameters(params)
requestString += requestStringFromParameters(params)
}
let request = NSURLRequest(URL: NSURL(string: requestString)!)
NSURLSession.sharedSession().dataTaskWithRequest(request) {
Expand Down Expand Up @@ -119,7 +119,9 @@ internal struct NetworkInterface {
var requestString = ""
for key in parameters.keys {
if let value = parameters[key] as? String, encodedValue = value.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLHostAllowedCharacterSet()) {
requestString = requestString + "&"+key+"="+encodedValue
requestString += "&\(key)=\(encodedValue)"
} else if let value = parameters[key] as? Int {
requestString += "&\(key)=\(value)"
}
}

Expand Down

0 comments on commit 319dc9a

Please sign in to comment.