dreamhead/moco — pull request #92 by jacksingleton (2014-09-09 22:12:37+00:00)
Title: Moco custom resource

We had a use case where we wanted to parse through the JSON body in the request and return a response based on the parsed values.

Although the template resource allowed us to use the request but it didn't give us enough control to parse JSON in the request.

We added a FromRequest resource that takes a generic function from request to response body.

We added a new mapping named 'fromrequest' in ResponseHandlers for our resource. We weren't sure if we needed to add a new mapping or use an existing one like 'text'. Was this the right thing to do?