diff --git a/Sources/SimpleHTTP/Request/Request.swift b/Sources/SimpleHTTP/Request/Request.swift index c5d44de..269954c 100644 --- a/Sources/SimpleHTTP/Request/Request.swift +++ b/Sources/SimpleHTTP/Request/Request.swift @@ -79,7 +79,7 @@ public struct Request { /// Creates a DELETE request with a Encodable body public static func delete(_ path: Path, body: Encodable, query: [String: QueryParam] = [:]) -> Self { - self.init(path: path, method: .delete, query: query, body: nil) + self.init(path: path, method: .delete, query: query, body: .encodable(body)) } /// Creates a Request. diff --git a/Tests/SimpleHTTPTests/Request/RequestTests.swift b/Tests/SimpleHTTPTests/Request/RequestTests.swift index 66e5bdd..5b69ad3 100644 --- a/Tests/SimpleHTTPTests/Request/RequestTests.swift +++ b/Tests/SimpleHTTPTests/Request/RequestTests.swift @@ -84,6 +84,11 @@ class RequestTests: XCTestCase { ) } + func test_initDelete_withBody_returnRequestWithBody() { + let request = Request.delete("", body: BodyMock()) + + XCTAssertNotNil(request.body) + } } private struct BodyMock: Encodable {