FR: (wontfix)URL readEntireTextStream return statusCode

Hi,
is it possible in URL::readEntireTextStream/URL::readEntireBinaryStream to return the statusCode from createInputStream?
Simply using an int pointer as optional return argument, straight forward.
Thanks…

The intention was just for those methods to be simple helpers, not something that would support many options. If you need more control or info, you should use URL::createInputStream directly. (If you actually look inside readEntireTextStream it’s actually a trivial function to write yourself)

That’s right, I looked into the code, I could simply duplicate the code from there.

I just thought in any case it is interesting for the caller to know the reason why the stream is empty.

I use it just as simple as the purpose of the method, downloading a <1024 bytes license file and I wanted to be able to differentiate if the server is unavailable or if it sends a permission denied…

EDIT: I especially dislike duplicating code in that way, because I will be barred from any improvements of that method.

Yes, of course you can make a case for adding the status code. There’s also a case for adding a timeout, a loading callback, some http headers, etc etc… But the thing with helper methods is that you have to keep them simple and avoid feature creep.

Ok, you are right. I just thought to add the int* to the arguments of readEntire* stuff. But as all arguments in createInputStream are default arguments, it’s no big deal to copy that line. As long as all functional improvements will go into createInputStream I won’t miss anything…
Cheers