crazytoad / meteor-collectionapi

Meteor Collection RESTful API
Other
276 stars 29 forks source link

Allow HTTP form POST in addition to HTTP json POST #9

Open 3-16 opened 11 years ago

3-16 commented 11 years ago

Although the optimal and most common way is to send JSON data to a REST API, there are cases when you need to use existing systems to POST and PUT data. These can send a common HTTP form like "value1=data1&data2=value2"

Check if the submitted data is in JSON format. If it is not, try to use querystring.parse(requestData) to convert the requestData to JSON format. If this does not work either, send the error message to the client.