Hi, I’m doing the Felgo udemy course by Grant Klimaytys, Christian Feldbacher. I’m getting this error for some reason. There was an similar problem in the tut that gave the “Fatal error in URL GET” which had to do with openSSL but, I downloaded the three files and it started working. This seems to be something else.
Where might this error be coming from? It seems like it’s successful the first time and then It’s called a second for some reason, and fails…
My input: london
Felgo Live Server Output:
GET: http://api.nestoria.co.uk/api?country=uk&pretty=1&encoding=json&listing_type=buy&action=search_listings&page=1&place_name=london
Success parsing JSON
Server returned app code: 100
Fatal error in URL GET
//I click the go button to search for "london" listings
AppButton {
text: qsTr("Go")
onClicked: search()
}
//The search function from Logic.qml is called
function search() {
logic.searchListings(searchInput.text, true)
}
//Logic.qml send a signal
signal searchListings (string searchText, bool addToRecents)
//Datamodel.qml receives the signal and calls client.search which calls response Callback as a parameter?? no more bool???
Connections {
id: logicConnection
onSearchListings:{
client.search(searchText, _.responseCallback)
}
}
//Client.qml search..
function search (text, callback){
_.sendRequest({
action: "search_listings",
page: 1,
place_name: text
}, callback)
}
Item {
id: _ //private member
readonly property string serverUrl: "http://api.nestoria.co.uk/api?country=uk&pretty=1&encoding=json&listing_type=buy"
property var lastParamMap: ({})
function buildUrl (paramMap){
var url = serverUrl
for (var param in paramMap){ //Gets loops for each URL parameter and adds it the to URL String
url += "&" + param + "=" + paramMap[param]
}
return url
}
function sendRequest (paramMap, callback) {
var method = "GET"
var url = buildUrl(paramMap)
console.debug(method + ": " + url)
HttpRequest.get(url)
.then(function(res){
var content = res.text
try {
var obj = JSON.parse(content)
}
catch (ex) {
console.error("Could not parse JSON", ex)
return
}
console.debug("Success parsing JSON")
callback(obj)
})
.catch(function(err){
console.debug(("Fatal error in URL GET"))
})
lastParamMap = paramMap
}
}