diff --git a/docs/http.md b/docs/http.md index 00fd104..7d14949 100644 --- a/docs/http.md +++ b/docs/http.md @@ -52,7 +52,7 @@ end function function parseResponse(response as Object) as Object user = CreateObject("roSGNode", "User") ' example custom roSGNode extending Node - user.status = response.rawData.status + user.status = response.raw.data.status return user end function diff --git a/src/components/http/HttpResponse.brs b/src/components/http/HttpResponse.brs index a60861c..47ea286 100644 --- a/src/components/http/HttpResponse.brs +++ b/src/components/http/HttpResponse.brs @@ -9,6 +9,7 @@ ' @param {String} responseData.failureReason ' @param {Object} responseData.headers ' @param {Integer} responseData.httpStatusCode +' @param {Object} responseData.rawData ' @param {Object} responseData.requestOptions ' @param {Integer} [responseData.time] function HttpResponse(responseData as Object) as Object @@ -25,7 +26,7 @@ function HttpResponse(responseData as Object) as Object prototype._failureReason = getProperty(responseData, "failureReason", "OK") prototype._headers = getProperty(responseData, "headers", {}) prototype._httpStatusCode = getProperty(responseData, "httpStatusCode", -1) - prototype._rawData = getProperty(responseData, "rawData", {}) + prototype._rawData = getProperty(responseData, "rawData") prototype._requestOptions = responseData.requestOptions prototype._time = DateTime().asSeconds() @@ -44,6 +45,7 @@ function HttpResponse(responseData as Object) as Object isReusable: m.isReusable(), isSuccess: m._isSuccess(), maxAge: m.getMaxAge(), + raw: { data: m._rawData }, rawData: m._rawData, requestOptions: m._requestOptions, }) diff --git a/src/components/http/HttpResponse.model.xml b/src/components/http/HttpResponse.model.xml index bb145ff..f9d5d0b 100644 --- a/src/components/http/HttpResponse.model.xml +++ b/src/components/http/HttpResponse.model.xml @@ -9,7 +9,8 @@ - + + diff --git a/src/components/http/_tests/HttpResponse_Main.test.brs b/src/components/http/_tests/HttpResponse_Main.test.brs index a5bd749..14757a7 100644 --- a/src/components/http/_tests/HttpResponse_Main.test.brs +++ b/src/components/http/_tests/HttpResponse_Main.test.brs @@ -18,6 +18,7 @@ function TestSuite__HttpResponse_Main() as Object headers: props.headers, id: props.id, isSuccess: true, + raw: { data: props.rawData }, rawData: props.rawData, }) @@ -43,6 +44,7 @@ function TestSuite__HttpResponse_Main() as Object httpStatusCode: props.httpStatusCode, failureReason: props.failureReason, headers: props.headers, + raw: { data: props.rawData }, rawData: props.rawData, }) diff --git a/src/components/http/request/_mocks/Request.mock.xml b/src/components/http/request/_mocks/Request.mock.xml index ab20eac..7325e0e 100644 --- a/src/components/http/request/_mocks/Request.mock.xml +++ b/src/components/http/request/_mocks/Request.mock.xml @@ -6,6 +6,8 @@ + +