PHP server connect returns invalid JSON under a very specific scenario

Wappler Version : Unknown (ask @kryo91)
Operating System : N/A
Server Model: PHP
Database Type: Unknown
Hosting Type: Unknown

Expected behavior

api.data should return an empty string, null or similar value under an HTTP response with a blank body, specifically a 301/302 redirect

Actual behavior

    "api": {
        "headers": {} // headers as expected
        "data":       // data has nothing in it, not even null!
    },
}

This is invalid JSON. Chrome seems more permissive, but this definitely triggers an error on Firefox’s developer tool network tab

How to reproduce

Not my project:

1 Like

The response of the API seems to be a binary file, the API action can’t handle binary data. Seems that the json_encode from PHP generates invalid JSON when a value contains binary, will see if I can somehow code some workaround which doesn’t break the output.