vendredi 1 juillet 2016

can i set a base url for expect()

My restangular call has a baseUrl set in a config file to "http://localhost:3000/". So a call like

Restangular.all("awards").customPOST(award)

calls at baseUrl+"awards"

Now when i write a test for this, i have to write

httpBackend.expectPOST("http://localhost:3000/awards")

But later if this baseUrl changes, i will have to change it in a lot many .expect() methods.

Is there anyway to set a baseUrl for the expect method, in a config file somewhere?

So that the expect method something like-

httpBackend.expectPOST(baseUrl + "awards");

So that any change in the baseUrl does not require any chnage in the expect() method?

Aucun commentaire:

Enregistrer un commentaire