Skip to content

Instantly share code, notes, and snippets.

@halfbaked
Created May 12, 2011 12:38
Show Gist options
  • Save halfbaked/968416 to your computer and use it in GitHub Desktop.
Save halfbaked/968416 to your computer and use it in GitHub Desktop.
using sinon.js to fake json response from server
server = sinon.fakeServer.create()
server.autoRespond=true
server.respondWith("GET", /\/customer\/(\d+)/, (xhr, id) ->
xhr.respond( 200, { "Content-Type": "application/json" }, JSON.stringify(window.sampleCustomerJson ))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment