Browse Source

Add test case and fix test server API for #154

Ben Hsieh 8 years ago
parent
commit
58ace5afd7
2 changed files with 12 additions and 1 deletions
  1. 1
    1
      test-server/server.js
  2. 11
    0
      test/test-0.10.0.js

+ 1
- 1
test-server/server.js View File

@@ -240,7 +240,7 @@ app.all('/cookie', (req, res) => {
240 240
 
241 241
 app.all('/err-body', (req, res) => {
242 242
   res.status(400)
243
-  res.write({ data : Date.now() })
243
+  res.write(JSON.stringify({ data : Date.now() }))
244 244
   res.end()
245 245
 })
246 246
 

+ 11
- 0
test/test-0.10.0.js View File

@@ -89,6 +89,17 @@ let begin = Date.now()
89 89
 //
90 90
 // })
91 91
 
92
+describe('#154 Allow passing unparsed response body to error handler ', (report, done) =>{
93
+
94
+  RNFetchBlob.fetch('get', `${TEST_SERVER_URL}/err-body`)
95
+  .then((res) => {
96
+    console.log(res)
97
+  })
98
+  .catch((err) => {
99
+    console.log(err)
100
+  })
101
+
102
+})
92 103
 
93 104
 describe('cookie test', (report, done) => {
94 105