fs: report correct path when EEXIST
[platform/upstream/nodejs.git] / deps / npm / node_modules / request / tests / test-errors.js
1 var server = require('./server')
2   , events = require('events')
3   , assert = require('assert')
4   , request = require('../index')
5   ;
6
7 var local = 'http://localhost:8888/asdf'
8
9 try {
10   request({uri:local, body:{}})
11   assert.fail("Should have throw") 
12 } catch(e) {
13   assert.equal(e.message, 'Argument error, options.body.')
14 }
15
16 try {
17   request({uri:local, multipart: 'foo'})
18   assert.fail("Should have throw")
19 } catch(e) {
20   assert.equal(e.message, 'Argument error, options.multipart.')
21 }
22
23 try {
24   request({uri:local, multipart: [{}]})
25   assert.fail("Should have throw")
26 } catch(e) {
27   assert.equal(e.message, 'Body attribute missing in multipart.')
28 }
29
30 try {
31   request(local, {multipart: [{}]})
32   assert.fail("Should have throw")
33 } catch(e) {
34   assert.equal(e.message, 'Body attribute missing in multipart.')
35 }
36
37 console.log("All tests passed.")