You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi team, thanks for this great tool!
I would like to ask a more detail question reguarding to the fake-response example:
Say I working a new feature work with a new API entry api/newFeature, so I would like mock only this new API entry:
xhook.before(function(request,callback){swtich(request.url){case'api/newFeature':
callback({status: 200,text: JSON.stringify({hello: 'world'}),// mock data, so I have to wait for API team's code
...
});break;
default:
??? // <------- how can I let other URL by passed and get real API resonse ?break;}});
The text was updated successfully, but these errors were encountered:
yanzou
changed the title
[Question] How to skip certain URL?
[Question] How to skip certain URL (some URL use mock and some still go to real API )?
Sep 29, 2023
yanzou
changed the title
[Question] How to skip certain URL (some URL use mock and some still go to real API )?
[Question] How to skip certain URL (some URL use mock data and some still go to real API )?
Sep 29, 2023
I think what you need is the next function provided by the connect repository.
xhook is fully supported, you have two options depending on the xhook.before mock response type
return response
xhook.before(function(request){switch(request.url){case"api/newFeature":
return{status: 200,text: JSON.stringify({hello: "world"}),// mock data, so I have to wait for API team's code};default:
// next, will fetch external linkreturn;}});
callback response
xhook.before(function(request,callback){switch(request.url){case"api/newFeature":
callback({status: 200,text: JSON.stringify({hello: "world"}),// mock data, so I have to wait for API team's code});default:
// next, will fetch external linkcallback();}});
Hi team, thanks for this great tool!
I would like to ask a more detail question reguarding to the
fake-response
example:Say I working a new feature work with a new API entry
api/newFeature
, so I would like mock only this new API entry:The text was updated successfully, but these errors were encountered: