mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-09 22:35:56 +05:45
### Changes: - `HTTPClient` has a new `X-Post-Params-Hash` request header - Replaced `HTTPRequest.Method.post`'s `Encodable` value with a more specific `HTTPRequestBody` (like `HTTPResponseBody`) - `HTTPRequestBody` allows overriding `contentForSignature` (it defaults to `[]`) which then `Signing` uses for the hash - Fixed `LogInOperation` not passing the `VerificationResult` to the result `CustomerInfo`. This is captured in unit and integration tests now. - Add support for signing `POST` requests in `Path.logIn` and `Path.postReceiptData` Depends on https://github.com/RevenueCat/khepri/pull/6246
33 lines
879 B
Swift
33 lines
879 B
Swift
//
|
|
// Copyright RevenueCat Inc. All Rights Reserved.
|
|
//
|
|
// Licensed under the MIT License (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// https://opensource.org/licenses/MIT
|
|
//
|
|
// HTTPRequestBody.swift
|
|
//
|
|
// Created by Nacho Soto on 7/5/23.
|
|
|
|
import Foundation
|
|
|
|
/// The content of an `HTTPRequest` for `HTTPRequest.Method.post`
|
|
protocol HTTPRequestBody: Encodable {
|
|
|
|
/// The keys and values that will be included in the signature.
|
|
/// - Note: this is not `[String: String]` because we need to preserve ordering.
|
|
var contentForSignature: [(key: String, value: String)] { get }
|
|
|
|
}
|
|
|
|
extension HTTPRequestBody {
|
|
|
|
// Default implementation for endpoints which don't support signing.
|
|
var contentForSignature: [(key: String, value: String)] {
|
|
return []
|
|
}
|
|
|
|
}
|