Skip to content

Commit

Permalink
Merge pull request #105 from earldouglas/post-parsing
Browse files Browse the repository at this point in the history
Add a test for urlencoded form posting support
  • Loading branch information
HardikJ committed Jan 3, 2015
2 parents 8bad503 + 2aa617e commit 5e9ee3f
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/features/services.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict';

// mocha defines to avoid JSHint breakage
/* global describe, it, before, beforeEach, after, afterEach */

var assert = require('../utils/assert.js');
var preq = require('preq');

module.exports = function (config) {

describe('PHP action API service', function() {
it('should accept form-based POST requests', function() {
return preq.post({
uri: config.hostPort + '/v1/en.wikipedia.org/_svc/action/query',
headers: {
host: 'en.wikipedia.org',
'content-type': 'application/x-www-form-urlencoded'
},
body: 'format=json&action=query&titles=Monads'
})
.then(function(res) {
assert.deepEqual(res.status, 200);
assert.deepEqual(res.body.items, [{
'pageid': 2834759,
'ns': 0,
'title': 'Monads'
}]);
});
});
});

};

0 comments on commit 5e9ee3f

Please sign in to comment.