I have a legacy app I'm upgrading with TouchDB. The app uses a UIWebView which contains a javascript page which reads and writes to the app's TouchDB database via touchdb:// get and post requests through query $.ajax(...) calls.
Get requests return fine and load the webpage with data. However Post requests are not working. When TouchDB gets the request it appears to not be receiving any HTTP request body. Despite there being one specified in the ajax call. Here is my ajax call from the javescript:
$.ajax({url:"touchdb:///rfsavedproposals/proposalSession", data: '{"_id":"proposal"}', type:'POST',success: function(){alert("success :-)");},error: function(){alert("fail :-(");}});
Touchdb definitely gets the request and debugging through it, both the request HTTPBody (NSData*) and request HTTPBodyStream (NSInputStream*) are nil.
I've been on this for two days now and have called in my jquery and javascript experts whoo are just as confused as I am. Hope someone here can help.
After some time I worked out this was being caused by UIWebView not posting body contents unless the HTTP or HTTPS scheme is used.