Skip to content

Commit

Permalink
Merge pull request #13 from PerfectlySoft/ACCEPT_ENCODING
Browse files Browse the repository at this point in the history
added .acceptEncoding option to enable decompression
  • Loading branch information
kjessup authored Jan 24, 2019
2 parents b5e20c7 + 5c0854c commit 8d1e4a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/PerfectCURL/CURLRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ open class CURLRequest {
replaceHeader(Header.Name, String),
/// Remove a default internally added header.
removeHeader(Header.Name),
/// Set the Accept-Encoding header and enable decompression of response data.
acceptEncoding(String),
/// Path to the client SSL certificate.
sslCert(String),
/// Specifies the type for the client SSL certificate. Defaults to `.pem`.
Expand Down
2 changes: 2 additions & 0 deletions Sources/PerfectCURL/CURLRequestOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ extension CURLRequest.Option {
curl.setOption(CURLOPT_READFUNCTION, f: curlFunc)
case .uploadFile(let path):
return CURLRequest.Option.upload(FileUploader(File(path))).apply(to: request)
case .acceptEncoding(let str):
curl.setOption(CURLOPT_ACCEPT_ENCODING, s: str)
}
}
}

0 comments on commit 8d1e4a5

Please sign in to comment.