You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing a macOS GUI for the qBittorrent daemon. The URL is built using the URLComponents structure:
var components: URLComponents {
var urlComponents = URLComponents()
urlComponents.path = apiBasePath + rawValue
var queryItems = [URLQueryItem]()
switch self {
case .info(let filter, let category, let tag, let sort, let reverse, let limit, let offset, let hashes):
if let filter = filter {
queryItems.append(URLQueryItem(name: "filter", value: filter.rawValue))
}
if let category = category {
queryItems.append(URLQueryItem(name: "category", value: category))
}
if let tag = tag {
queryItems.append(URLQueryItem(name: "tag", value: tag))
}
if let sort = sort {
queryItems.append(URLQueryItem(name: "sort", value: sort.rawValue))
}
if let reverse = reverse {
queryItems.append(URLQueryItem(name: "reverse", value: "\(reverse)"))
}
if let limit = limit {
queryItems.append(URLQueryItem(name: "limit", value: "\(limit)"))
}
if let offset = offset {
queryItems.append(URLQueryItem(name: "offset", value: "\(offset)"))
}
if let hashes = hashes {
queryItems.append(URLQueryItem(name: "hashes", value: hashes))
}
. . . . . .
if !queryItems.isEmpty {
urlComponents.queryItems = queryItems
}
return urlComponents
}
private func buildURLWithEndpoint<Endpoint: APIEndpoint>(_ endpoint: Endpoint) -> URL? {
var urlComponents = endpoint.components
urlComponents.scheme = server.useHTTPS ? "https" : "http"
urlComponents.host = server.host
urlComponents.port = Int(server.port)
return urlComponents.url
}
The daemon ignores any request parameters be it filter, sort, tag, etc. and returns a list of all torrents. I tried to log the URL of the request, copied it and called it in the terminal via curl. To my surprise, the demon returned a filtered list of torrents. An example request in the terminal: curl 'http://192.168.1.1:9080/api/v2/torrents/info?filter=paused'
Please help me figure out why the daemon ignores request parameters in the MacOS application? Maybe the daemon requires some special encoding for the "?=" characters?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi!
I'm writing a macOS GUI for the qBittorrent daemon. The URL is built using the URLComponents structure:
The daemon ignores any request parameters be it filter, sort, tag, etc. and returns a list of all torrents. I tried to log the URL of the request, copied it and called it in the terminal via curl. To my surprise, the demon returned a filtered list of torrents. An example request in the terminal:
curl 'http://192.168.1.1:9080/api/v2/torrents/info?filter=paused'
Please help me figure out why the daemon ignores request parameters in the MacOS application? Maybe the daemon requires some special encoding for the "?=" characters?
Beta Was this translation helpful? Give feedback.
All reactions