yeah you are right look weird and it should be fixed. 
Btw the reason of current implementation is in the simplicity - the code does not contain 'if...else' conditions for port and uri.