Move all AsyncHTTPClient code to request.swift
This commit is contained in:
parent
748a78686b
commit
2afe2385b7
|
@ -10,6 +10,20 @@ import Foundation
|
|||
import NIO
|
||||
import NIOHTTP1
|
||||
|
||||
public extension AWSSigner.BodyData {
|
||||
/// Convert to HTTPClient Body struct
|
||||
var body : HTTPClient.Body {
|
||||
switch self {
|
||||
case .string(let string):
|
||||
return .string(string)
|
||||
case .data(let data):
|
||||
return .data(data)
|
||||
case .byteBuffer(let byteBuffer):
|
||||
return .byteBuffer(byteBuffer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public extension HTTPClient {
|
||||
/// return signed HTTPClient request with signature in the headers
|
||||
static func awsHeaderSignedRequest(url: URL, method: HTTPMethod = .GET, headers: HTTPHeaders = HTTPHeaders(), body: AWSSigner.BodyData? = nil, date: Date = Date(), signer: AWSSigner) throws -> HTTPClient.Request {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
// AWS documentation about signing requests is here https://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html
|
||||
//
|
||||
|
||||
import AsyncHTTPClient
|
||||
import Foundation
|
||||
import NIO
|
||||
import NIOHTTP1
|
||||
|
@ -33,17 +32,6 @@ public class AWSSigner {
|
|||
case string(String)
|
||||
case data(Data)
|
||||
case byteBuffer(ByteBuffer)
|
||||
|
||||
var body : HTTPClient.Body {
|
||||
switch self {
|
||||
case .string(let string):
|
||||
return .string(string)
|
||||
case .data(let data):
|
||||
return .data(data)
|
||||
case .byteBuffer(let byteBuffer):
|
||||
return .byteBuffer(byteBuffer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Generate signed headers, for a HTTP request
|
||||
|
|
Loading…
Reference in New Issue