Adam Cameron
<cfhttp>
call, precisely for this; then you mock that out.Adam Cameron
// MyHttpAdapter.cfc
component {
function makerequest(url, etc) {
http url=arguments.url result=local.result;
return local.result
}
}
Adam Cameron
Adam Cameron
MyHttpAdapter.makeRequest
that does a legit call to example.com or some internal test fixture which has a known canned response, etc.Adam Cameron
richard.herbert
04/14/2023, 1:05 PMrequest
scope bleeding in and a id value being an optional argument), to create a method to wrap around the request so I can mock it before I can start testing.
<cfhttp
charset = "utf-8"
url = "#request.api_endpoingUrl#/emp/customerstatusapi/v1/#customerid#"
method="get"
username = "#request.api_username#"
password = "#request.api_password#"
timeout = "20"
result = "result_raw">
</cfhttp>
Thanks for the confirmation Adam.