GodotNuts / GodotFirebase

Implementations of Firebase for Godot using GDScript
MIT License
530 stars 76 forks source link

[BUG] Firebase Function with GET method doesn't pass parameters (with possible solution) #306

Closed adavidm closed 2 years ago

adavidm commented 2 years ago

Describe the bug I was having trouble using Firebase Functions, where the parameters are not being passed to Firebase. I think I have identified the cause.

To Reproduce Steps to reproduce the behavior:

Expected behavior A clear and concise description of what you expected to happen, for example:

parameters should be passed through to Firebase

possible solution

Looking at functions.gd, it appears that the _url parameter is being passed to function_task too early:

    var url : String = _base_url + ("/" if not _base_url.ends_with("/") else "") + function
    function_task._url = url

    if not params.empty():
        url += "?"
        for key in params.keys():
            url += key + "=" + params[key] + "&"

I've tried moving the assignment after the loop and it seems to work for me now

fenix-hub commented 2 years ago

Yes indeed, your solution was the intended one. Mind creating a pull request, if you feel like contributing?

adavidm commented 2 years ago

sure, I've never done that before so hopefully not too difficult. Will give it a go now.

adavidm commented 2 years ago

That's done:

https://github.com/GodotNuts/GodotFirebase/pull/307