[REST] fix headersonly flag for BINARY responses / overhaul format handling

Spaces after ifs please.