fix(transport): URL-Konstruktion encoded ?-Query nicht mehr
URL.appending(path:) behandelt das ? in Query-Strings als Pfad- Component und URL-encoded es zu %3F. Server-Route-Matching scheiterte mit 404 für alle Endpoints mit Query-Parametern. Symptom in cards-native v0.8.x: alle Card-Counts und Due-Counts auf 0, DeckDetailView Cards-Liste leer mit "Server-Fehler (404)" auf /api/v1/cards?deck_id=X. Fix: String-Konkatenation baseURL.absoluteString + path. Caller liefert path inkl. führendem / und optionaler Query. URLRequest parsed das Resultat korrekt. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
df6f67ee45
commit
74aee8d47f
1 changed files with 9 additions and 1 deletions
|
|
@ -40,7 +40,15 @@ public actor AuthenticatedTransport {
|
|||
contentType: String,
|
||||
token: String
|
||||
) async throws -> (Data, HTTPURLResponse) {
|
||||
var request = URLRequest(url: baseURL.appending(path: path))
|
||||
// String-Konkatenation statt `baseURL.appending(path:)`, weil
|
||||
// letzteres das `?` in Query-Strings als Path-Component
|
||||
// behandelt und URL-encoded (`?` → `%3F`) — der Server-Routes-
|
||||
// Match scheitert dann mit 404. Caller liefert path inkl.
|
||||
// führendem `/` und optionaler Query.
|
||||
guard let url = URL(string: baseURL.absoluteString + path) else {
|
||||
throw AuthError.networkFailure("Ungültige URL: \(path)")
|
||||
}
|
||||
var request = URLRequest(url: url)
|
||||
request.httpMethod = method
|
||||
request.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization")
|
||||
if let body {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue