Skip to content

Commit

Permalink
Swifty 1.0.1
Browse files Browse the repository at this point in the history
#### Fixed
- Improved Query Preservation in `BaseResource` modifiers, if URLComponents fails to parse the URL
  • Loading branch information
Siddharth Gupta committed Oct 31, 2017
1 parent c661f37 commit 688744e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## [1.0.1](https://github.com/Flipkart/Swifty/releases/tag/1.0.1)
Released on 2017-10-31.

#### Fixed
- Improved Query Preservation in `BaseResource` modifiers

## [1.0.0](https://github.com/Flipkart/Swifty/releases/tag/1.0.0)
Released on 2017-10-31.

Expand Down
15 changes: 15 additions & 0 deletions Sources/WebService/BaseResource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,21 @@ fileprivate extension URL {
mutating func appendPathComponentPreservingQuery(path: String, isDirectory: Bool) {

guard let components = URLComponents(string: path), let query = components.query else {

/// This mean URLComponents failed to parse the URL
if(path.contains("?")){
let split = path.split(separator: "?", maxSplits: 1, omittingEmptySubsequences: true)
if split.count > 1 {
let splitPath = String(split[0])
let splitQuery = String(split[1])
self.appendPathComponent(splitPath, isDirectory: isDirectory)
if let url = URL(string: "\(self.absoluteString)?\(splitQuery)") {
self = url
}
return
}
}

self.appendPathComponent(path, isDirectory: isDirectory)
return
}
Expand Down
2 changes: 1 addition & 1 deletion Swifty.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Swifty'
s.version = '1.0.0'
s.version = '1.0.1'
s.summary = 'Lightweight & Fast Network Abstraction Layer for iOS'

s.description = <<-DESC
Expand Down

0 comments on commit 688744e

Please sign in to comment.