I have this code in javascript:
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.json());
app.post('/test', function (req, res) {
console.log(req.body);
})
var server = app.listen(8080, function () {
})
From a rails app I am suppose to receive this json in the body:
{"content": "some content", "test":"some tests"}
but instead I receive this one:
{ '{"content":"some content","test":"some test"}' : ''}
Any idea of what I am doing wrong??
This is the way the JSON is sent:
Hi, this is the way the JSON is sent:
response = JSON.parse RestClient.post("#{test_runner_url}/test", {content: content, test: test}.to_json)
Aucun commentaire:
Enregistrer un commentaire