overriding the port from network.request() api

I don’t see what the difference is.  You use a string, which can either be “localhost” or “127.0.0.1” or you have a string that is the DNS name of your server.  At some point you have to change your local name to your remote name, and if the name is just a string it shouldn’t matter what it is.

If you’re going to be changing it or not I would use something like:

local useLocalHost = true

local host = "http://myremoteserver.com"

if useLocalHost then

     host = “127.0.0.1”

end

Then just use the variable host in your code.  You can quickly toggle that flag on and off depending on where you want to test.