summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/request/tests/test-errors.js
blob: e5df87b56cc890edc3a7161d70bc830451e4d8e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var server = require('./server')
  , events = require('events')
  , assert = require('assert')
  , request = require('../main.js')
  ;

var local = 'http://localhost:8888/asdf'

try {
  request({uri:local, body:{}})
  assert.fail("Should have throw") 
} catch(e) {
  assert.equal(e.message, 'Argument error, options.body.')
}

try {
  request({uri:local, multipart: 'foo'})
  assert.fail("Should have throw")
} catch(e) {
  assert.equal(e.message, 'Argument error, options.multipart.')
}

try {
  request({uri:local, multipart: [{}]})
  assert.fail("Should have throw")
} catch(e) {
  assert.equal(e.message, 'Body attribute missing in multipart.')
}

console.log("All tests passed.")