2012-02-06 76 views
1

的響應如何假扮我想在發展模式中執行以下代碼:使用SC-服務器

App.statecharts.someState = SC.State.design({ 
    enterState: function() { 
    SC.Request 
     .getUrl('/someUrl') 
     .json() 
     .header({ 'Accept': 'application/json' }) 
     .notify(this, 'checkIsAnswer') 
     .send(); 
    }, 
    checkIsAnswer: function(response) { 
    console.log(response); 
    } 
}); 

要做到這一點,我需要假從服務器的響應。例如:
例如: http://localhost:4020/someUrl schould是一個靜態JSON

如何使用sc-server來僞造此響應。

回答

0

sc-server有一個代理。

嘗試將proxy '/someUrl', :to => 'myinternalserver.com:9090'添加到您的生成文件。

然後,您可以使您的硬編碼假JSON響應從http://myinternalserver.com:9090/someUrl訪問。任何Web服務器都可以。

希望這會有所幫助。