use decorator to factorize out the http connection part and the target url generation, test updated