I was testing the support for CouchDB in Lift 2.0 when I noticed that it's not possible to add records to CouchDB when calling method CouchRecord.save. For some reason CouchDB 1.0 and newer (1.0.1 is the most recent release), expect the calling application to use application/json as the content type for the REST request, but Lift 2.0 is not doing that (yet)
The fix is very straightforward in net.liftweb.couchdb.DispatchJSON.scala, add the following to methods put and post:
// required for couchdb 1.0.x and newer
val strEntity = new StringEntity(Printer.compact(render(jvalue)), Request.factoryCharset)
strEntity.setContentType("application/json")
m.setEntity(strEntity)
Make sure you replace this line with the ones above:
m.setEntity(new StringEntity(Printer.compact(render(jvalue)), Request.factoryCharset))
(note that it's the same code for both methods)
Hopefully this will be addressed in a future release of the Lift framework.