Skip to content

Commit e689c1e

Browse files
committed
fix WebPage 삭제 endpoint 인코딩 수정
1 parent fa68c90 commit e689c1e

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

Application/Infra/Sources/Service/FunctionAPIEndpoint.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ extension FunctionAPIEndpoint where Response == EmptyAPIResponse {
1616
Self(method: .delete, path: "/todos/\(functionAPIPathSegment(id))/deletion-request")
1717
}
1818

19+
// WebPage id는 이미 Firestore document id로 percent-encoded된 값
20+
// 여기서 다시 인코딩하면 Functions가 실제 문서 id와 다른 값을 받는다
1921
static func requestWebPageDeletion(_ id: String) -> Self {
20-
Self(method: .post, path: "/web-pages/\(functionAPIPathSegment(id))/deletion-request")
22+
Self(method: .post, path: "/web-pages/\(id)/deletion-request")
2123
}
2224

2325
static func undoWebPageDeletion(_ id: String) -> Self {
24-
Self(method: .delete, path: "/web-pages/\(functionAPIPathSegment(id))/deletion-request")
26+
Self(method: .delete, path: "/web-pages/\(id)/deletion-request")
2527
}
2628

2729
static func requestPushNotificationDeletion(_ id: String) -> Self {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//
2+
// FunctionAPIEndpointTests.swift
3+
// InfraTests
4+
//
5+
// Created by opfic on 7/3/26.
6+
//
7+
8+
import Testing
9+
@testable import Infra
10+
11+
struct FunctionAPIEndpointTests {
12+
@Test("WebPage 삭제 endpoint는 Firestore document id를 재인코딩하지 않는다")
13+
func WebPage_삭제_endpoint는_Firestore_document_id를_재인코딩하지_않는다() {
14+
let id = "https%3A%2F%2Fgithub%2Ecom%2Fopficdev"
15+
let endpoint = FunctionAPIEndpoint<EmptyAPIResponse>.requestWebPageDeletion(id)
16+
17+
#expect(endpoint.path == "/web-pages/\(id)/deletion-request")
18+
}
19+
20+
@Test("WebPage 삭제 복구 endpoint는 Firestore document id를 재인코딩하지 않는다")
21+
func WebPage_삭제_복구_endpoint는_Firestore_document_id를_재인코딩하지_않는다() {
22+
let id = "https%3A%2F%2Fgithub%2Ecom%2Fopficdev"
23+
let endpoint = FunctionAPIEndpoint<EmptyAPIResponse>.undoWebPageDeletion(id)
24+
25+
#expect(endpoint.path == "/web-pages/\(id)/deletion-request")
26+
}
27+
}

0 commit comments

Comments
 (0)