Important bug fix
No need to percentage encoding base path at the client initialization time, it will be done later in a much more sophisticated way when prepare a request. It’s enough to just attempt to create URL from base path string to do basic validation of the provided base path.
This commit is contained in:
parent
8fbfc92bb0
commit
df824b93d3
|
@ -45,9 +45,7 @@ struct APIClient: APIClientCore
|
||||||
) throws
|
) throws
|
||||||
{
|
{
|
||||||
guard
|
guard
|
||||||
let percentEncodedBasePath = basePath.addingPercentEncoding(
|
URL(string: basePath) != nil
|
||||||
withAllowedCharacters: .urlPathAllowed
|
|
||||||
)
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw InvalidBasePath(basePath: basePath)
|
throw InvalidBasePath(basePath: basePath)
|
||||||
|
@ -55,7 +53,7 @@ struct APIClient: APIClientCore
|
||||||
|
|
||||||
//===
|
//===
|
||||||
|
|
||||||
self.basePath = percentEncodedBasePath
|
self.basePath = basePath
|
||||||
|
|
||||||
self.session = URLSession(
|
self.session = URLSession(
|
||||||
configuration: sessionConfig,
|
configuration: sessionConfig,
|
||||||
|
|
|
@ -92,4 +92,3 @@ extension APIClientCore
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue