Skip to content

Commit

Permalink
fix: DELETE method for ElasticSearch (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
portellaa authored Nov 11, 2019
1 parent 4390ef8 commit 7fca92c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Sources/YouClap/ElasticSearchConnectable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ public final class ElasticSearchConnectable {
var request = HTTPRequest(method: .POST, url: path, body: data)
request.contentType = .json

return client()
.flatMap { $0.send(request) }
return client().flatMap { $0.send(request) }
} catch {
return container.future(error: error)
}
Expand All @@ -37,13 +36,18 @@ public final class ElasticSearchConnectable {
var request = HTTPRequest(method: .PUT, url: path, body: data)
request.contentType = .json

return client()
.flatMap { $0.send(request) }
return client().flatMap { $0.send(request) }
} catch {
return container.future(error: error)
}
}

public func delete(_ path: String) -> Future<HTTPResponse> {
let request = HTTPRequest(method: .DELETE, url: path)

return client().flatMap { $0.send(request) }
}

// MARK: - Private Methods

private func client() -> Future<HTTPClient> {
Expand Down

0 comments on commit 7fca92c

Please sign in to comment.