updated to shouldRemoveDefaultEncoding

This commit is contained in:
Krishna Kishore Bandaru 2024-03-05 11:31:31 +05:30
parent bed4b5c837
commit d46093887c
3 changed files with 2 additions and 4 deletions

View File

@ -58,7 +58,6 @@ extern NSString * const KeyCallNumber;
extern NSString * const KeyPhoneNumber; extern NSString * const KeyPhoneNumber;
extern NSString * const KeyPresentationStyle; extern NSString * const KeyPresentationStyle;
extern NSString * const KeyExtraParameters; extern NSString * const KeyExtraParameters;
extern NSString * const KeyExtraEncodedParameters;
extern NSString * const KeyContextRoot; extern NSString * const KeyContextRoot;
extern NSString * const KeyType; extern NSString * const KeyType;

View File

@ -58,7 +58,6 @@ NSString * const KeyCallNumber = @"callNumber";
NSString * const KeyPhoneNumber = @"phoneNumber"; NSString * const KeyPhoneNumber = @"phoneNumber";
NSString * const KeyPresentationStyle = @"presentationStyle"; NSString * const KeyPresentationStyle = @"presentationStyle";
NSString * const KeyExtraParameters = @"extraParameters"; NSString * const KeyExtraParameters = @"extraParameters";
NSString * const KeyExtraEncodedParameters = @"extraEncodedParameters";
NSString * const KeyContextRoot = @"appContext"; NSString * const KeyContextRoot = @"appContext";
NSString * const KeyType = @"type"; NSString * const KeyType = @"type";

View File

@ -53,7 +53,7 @@ extension JSONDictionary {
return string return string
} }
public func toUrlQueryItems(shouldRemoveEncoding: Bool = true) throws -> [URLQueryItem] { public func toUrlQueryItems(shouldRemoveDefaultEncoding: Bool = false) throws -> [URLQueryItem] {
var queryItems: [URLQueryItem] = [] var queryItems: [URLQueryItem] = []
for (key, value) in self { for (key, value) in self {
var valueString: String var valueString: String
@ -63,7 +63,7 @@ extension JSONDictionary {
valueString = try value.toJSONString() valueString = try value.toJSONString()
} else { } else {
valueString = String(describing: value.base) valueString = String(describing: value.base)
if shouldRemoveEncoding { if shouldRemoveDefaultEncoding {
guard let encodedValue = valueString.removingPercentEncoding else { throw JSONError.error(message:"query item failed: \(key) value \(value.base)") } guard let encodedValue = valueString.removingPercentEncoding else { throw JSONError.error(message:"query item failed: \(key) value \(value.base)") }
valueString = encodedValue valueString = encodedValue
} }