@dazn/kopytko-framework 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
' @import /components/buildUrl.brs from @dazn/kopytko-utils
|
|
2
2
|
' @import /components/getProperty.brs from @dazn/kopytko-utils
|
|
3
|
+
' @import /components/getType.brs from @dazn/kopytko-utils
|
|
3
4
|
' @import /components/rokuComponents/Timespan.brs from @dazn/kopytko-utils
|
|
4
5
|
' @import /components/rokuComponents/UrlTransfer.brs from @dazn/kopytko-utils
|
|
5
6
|
' @import /components/ternary.brs from @dazn/kopytko-utils
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
' @property {Object} headers
|
|
14
15
|
' @property {Integer} timeout
|
|
15
16
|
' @property {Object} body
|
|
17
|
+
' @property {String} bodyString
|
|
16
18
|
|
|
17
19
|
' Request logic.
|
|
18
20
|
' @class
|
|
@@ -51,7 +53,7 @@ function HttpRequest(options as Object, httpInterceptors = [] as Object) as Obje
|
|
|
51
53
|
m._urlTransfer.initClientCertificates()
|
|
52
54
|
end if
|
|
53
55
|
|
|
54
|
-
if (
|
|
56
|
+
if (getType(m._options.headers) = "roAssociativeArray")
|
|
55
57
|
m._headers.append(m._options.headers)
|
|
56
58
|
end if
|
|
57
59
|
|
|
@@ -65,7 +67,7 @@ function HttpRequest(options as Object, httpInterceptors = [] as Object) as Obje
|
|
|
65
67
|
prototype.send = function () as Object
|
|
66
68
|
method = m.getMethod()
|
|
67
69
|
|
|
68
|
-
if (method <> "POST" AND method <> "PUT") then m._headers.delete("Content-Type")
|
|
70
|
+
if (method <> "PATCH" AND method <> "POST" AND method <> "PUT") then m._headers.delete("Content-Type")
|
|
69
71
|
m._urlTransfer.setHeaders(m._headers)
|
|
70
72
|
|
|
71
73
|
for each interceptor in m._httpInterceptors
|
|
@@ -74,11 +76,13 @@ function HttpRequest(options as Object, httpInterceptors = [] as Object) as Obje
|
|
|
74
76
|
|
|
75
77
|
if (method = "GET")
|
|
76
78
|
m._urlTransfer.asyncGetToString()
|
|
77
|
-
else if (method = "POST" OR method = "PUT" OR method = "DELETE")
|
|
79
|
+
else if (method = "PATCH" OR method = "POST" OR method = "PUT" OR method = "DELETE")
|
|
78
80
|
body = ""
|
|
79
81
|
|
|
80
82
|
if (m._options.body <> Invalid)
|
|
81
83
|
body = FormatJSON(m._options.body)
|
|
84
|
+
else if (getType(m._options.bodyString) = "roString")
|
|
85
|
+
body = m._options.bodyString
|
|
82
86
|
end if
|
|
83
87
|
|
|
84
88
|
m._urlTransfer.asyncPostFromString(body)
|