cjohansen/Sinon.JS — pull request #466 by gdw2 (2014-04-19 05:16:40+00:00)
Title: Fix to allow fakeserver response body to be function

Something like this was supposed to be possible (pardon the coffeescript) using fakeserver. The function was being used to perform the match, but not to generate the response.

server.respondWith("POST","/api/users",
()->
params = JSON.parse(arguments[0].requestBody)
return [200, {"Content-Type":"application/json"},JSON.stringify(params)]
)