Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update(27062): SNA URL request updated to POST #7

Merged
merged 4 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions SNASources/CellularSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ @implementation CellularSession
@param url The URL to be requested
@return A string response from the request to the URL
*/
- (CellularSessionResult * _Nonnull)performGetRequest:(NSURL * _Nonnull)url {
- (CellularSessionResult * _Nonnull)performRequest:(NSURL * _Nonnull)url {
// Prepare a class to return results.
CellularSessionResult *sessionResult = [[CellularSessionResult alloc] init];
sessionResult.result = nil;
Expand Down Expand Up @@ -180,7 +180,7 @@ - (CellularSessionResult * _Nonnull)performGetRequest:(NSURL * _Nonnull)url {

// Create the HTTP request string
NSString *requestString = [NSString
stringWithFormat:@"GET %@%@ HTTP/1.2\r\nHost: %@%@\r\n",
stringWithFormat:@"POST %@%@ HTTP/1.2\r\nHost: %@%@\r\nAccept: */*\r\nContent-Type: application/json\r\nContent-Length: 0\r\n",
mejiagarcia marked this conversation as resolved.
Show resolved Hide resolved
[url path],
[url query] ? [@"?" stringByAppendingString:[url query]] : @"",
[url host],
Expand Down
2 changes: 1 addition & 1 deletion SNASources/include/CellularSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#import "CellularSessionProtocol.h"

@interface CellularSession : NSObject <CellularSessionProtocol>
- (CellularSessionResult * _Nonnull)performGetRequest:(NSURL * _Nonnull)url;
- (CellularSessionResult * _Nonnull)performRequest:(NSURL * _Nonnull)url;
@end

#endif /* HTTPRequester_h */
2 changes: 1 addition & 1 deletion SNASources/include/CellularSessionProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@

@protocol CellularSessionProtocol
@required
- (CellularSessionResult * _Nonnull)performGetRequest:(NSURL * _Nonnull)url;
- (CellularSessionResult * _Nonnull)performRequest:(NSURL * _Nonnull)url;
@end
2 changes: 1 addition & 1 deletion Sources/Networking/NetworkRequestProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ extension NetworkRequestProvider: NetworkRequestProviderProtocol {
onComplete: @escaping NetworkRequestResult
) {
networkRequestQueue.async {
let networkOperationOnCellularData = self.cellularSession.performGetRequest(url)
let networkOperationOnCellularData = self.cellularSession.performRequest(url)

guard case .success = networkOperationOnCellularData.status else {
onComplete(
Expand Down
2 changes: 1 addition & 1 deletion Tests/Domain/Mocks/MockCellularSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class MockCellularSession: CellularSessionProtocol {
self.status = status
}

func performGetRequest(_ url: URL) -> CellularSessionResult {
func performRequest(_ url: URL) -> CellularSessionResult {
let result = CellularSessionResult()
result.status = status
result.result = String(describing: status)
Expand Down
2 changes: 1 addition & 1 deletion Tests/Domain/Mocks/MockNetworkRequestProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct MockNetworkRequestProvider: NetworkRequestProviderProtocol {
}

func performRequest(url: URL, onComplete: @escaping NetworkRequestResult) {
let request = session.performGetRequest(url)
let request = session.performRequest(url)

guard let result = request.result else {
return onComplete(.failure(.requestFinishedWithNoResult))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ final class PhoneNumberViewController: UIViewController {

// MARK: - IBOutlets

@IBOutlet private var appVersionLabel: UILabel!
@IBOutlet private var backendUrlTextField: UITextField!
@IBOutlet private var phoneNumberTextField: UITextField!
@IBOutlet private var phoneCountryCodeTextField: UITextField!
Expand Down Expand Up @@ -347,6 +348,9 @@ extension PhoneNumberViewController {
)
$0?.layer.borderColor = borderColor.cgColor
}

/// Only used for reference
appVersionLabel.text = "\(appVersionLabel.text ?? "") \(TwilioVerifySNAConfig.version)"
mejiagarcia marked this conversation as resolved.
Show resolved Hide resolved
}

/// Not required for the SDK implementation.
Expand Down