Moya version: master integrated by GitHub
part of code sample:
enum Api {
case initialize(deviceName: String, upushDeviceToken: String)
case loadImage(_ url: String)
}
extension Api: TargetType {
var baseURL: URL {
URL(string: ApiKit.baseUrl)!
}
var path: String {
switch self {
case .initialize:
return "init"
case .loadImage(let url):
return "\(url)"
}
}
the loadImage request url is an absolute url like https://some-site/storage/image.png
When I tried loadImage, it combined basic url and the url, therefore server side return error 404
I guess it might have a solution of creating another TargetType to handle these absolute url requests, but I still want to know if there's a way to solve this in one TargetType.
Hope this helps.
BaseURL + path is the final URL = https://some-website.com/storage/image.png