From beb015b4221b758c0f0882ec504a5162ff185ab0 Mon Sep 17 00:00:00 2001 From: christian Date: Wed, 20 Apr 2022 01:44:18 -0400 Subject: [PATCH 1/3] Adding allow fragments option to tryParseJson --- ios/Plugin/HttpRequestHandler.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Plugin/HttpRequestHandler.swift b/ios/Plugin/HttpRequestHandler.swift index d3d5f26d..9038955a 100644 --- a/ios/Plugin/HttpRequestHandler.swift +++ b/ios/Plugin/HttpRequestHandler.swift @@ -32,7 +32,7 @@ fileprivate enum ResponseType: String { /// - Returns: The parsed value or an error func tryParseJson(_ data: Data) -> Any { do { - return try JSONSerialization.jsonObject(with: data, options: .mutableContainers) + return try JSONSerialization.jsonObject(with: data, options: [.mutableContainers, .allowFragments]) } catch { return error.localizedDescription } From 32e4295be58f62da881045da1e42d4892c2ad353 Mon Sep 17 00:00:00 2001 From: christian Date: Wed, 20 Apr 2022 01:59:51 -0400 Subject: [PATCH 2/3] Adding npm run build to prepare step to be able to install from github --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4e76ed48..15c194cf 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "fmt": "npm run prettier -- --write", "prettier": "prettier \"**/*.{css,html,ts,js,java}\"", "prepublishOnly": "npm run build && npm run ios:build", - "prepare": "husky install" + "prepare": "husky install && npm run build" }, "author": "Max Lynch , Thomas Vidas ", "license": "MIT", From 2b82c560ce0b2f31b2b48411e9fe06a4f7d33588 Mon Sep 17 00:00:00 2001 From: christian Date: Wed, 20 Apr 2022 09:31:39 -0400 Subject: [PATCH 3/3] Using fragmentsAllowed option in place of deprecated allowFragments --- ios/Plugin/HttpRequestHandler.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Plugin/HttpRequestHandler.swift b/ios/Plugin/HttpRequestHandler.swift index 9038955a..e4137f62 100644 --- a/ios/Plugin/HttpRequestHandler.swift +++ b/ios/Plugin/HttpRequestHandler.swift @@ -32,7 +32,7 @@ fileprivate enum ResponseType: String { /// - Returns: The parsed value or an error func tryParseJson(_ data: Data) -> Any { do { - return try JSONSerialization.jsonObject(with: data, options: [.mutableContainers, .allowFragments]) + return try JSONSerialization.jsonObject(with: data, options: [.mutableContainers, .fragmentsAllowed]) } catch { return error.localizedDescription }