Skip to content

Commit

Permalink
Add a test for request header param
Browse files Browse the repository at this point in the history
  • Loading branch information
Raymond Feng committed Sep 19, 2014
1 parent f4000d0 commit 04e582d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
21 changes: 21 additions & 0 deletions test/rest.browser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,27 @@ describe('strong-remoting-rest', function(){
});
});

it('should allow arguments in the header', function(done) {
var method = givenSharedStaticMethod(
function bar(a, b, cb) {
cb(null, a + b);
},
{
accepts: [
{ arg: 'b', type: 'number' },
{ arg: 'a', type: 'number', http: {source: 'header' } }
],
returns: { arg: 'n', type: 'number' },
http: { path: '/' }
}
);

objects.invoke(method.name, [1, 2], function(err, n) {
assert.equal(n, 3);
done();
});
});

it('should pass undefined if the argument is not supplied', function (done) {
var called = false;
var method = givenSharedStaticMethod(
Expand Down
1 change: 0 additions & 1 deletion test/rest.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ describe('strong-remoting-rest', function(){
it('should allow string[] arg in the query', function(done) {
var method = givenSharedStaticMethod(
function bar(a, b, cb) {
console.log(a, b, typeof b);
cb(null, b.join('') + a);
},
{
Expand Down

0 comments on commit 04e582d

Please sign in to comment.