@@ -2,7 +2,6 @@ var assert = require('chai').assert
22var supertest = require ( 'supertest' )
33var path = require ( 'path' )
44var nock = require ( 'nock' )
5- var async = require ( 'async' )
65
76var ldnode = require ( '../../index' )
87
@@ -108,30 +107,19 @@ describe('CORS Proxy', () => {
108107 . expect ( 200 , done )
109108 } )
110109
111- it ( 'should return the same HTTP status code as the uri' , ( done ) => {
112- async . parallel ( [
113- // 500
114- ( next ) => {
115- nock ( 'https://example.org' ) . get ( '/404' ) . reply ( 404 )
116- server . get ( '/proxy/?uri=https://example.org/404' )
117- . expect ( 404 , next )
118- } ,
119- ( next ) => {
120- nock ( 'https://example.org' ) . get ( '/401' ) . reply ( 401 )
121- server . get ( '/proxy/?uri=https://example.org/401' )
122- . expect ( 401 , next )
123- } ,
124- ( next ) => {
125- nock ( 'https://example.org' ) . get ( '/500' ) . reply ( 500 )
126- server . get ( '/proxy/?uri=https://example.org/500' )
127- . expect ( 500 , next )
128- } ,
129- ( next ) => {
130- nock ( 'https://example.org' ) . get ( '/' ) . reply ( 200 )
131- server . get ( '/proxy/?uri=https://example.org/' )
132- . expect ( 200 , next )
133- }
134- ] , done )
110+ it ( 'should return the same HTTP status code as the uri' , ( ) => {
111+ nock ( 'https://example.org' )
112+ . get ( '/404' ) . reply ( 404 )
113+ . get ( '/401' ) . reply ( 401 )
114+ . get ( '/500' ) . reply ( 500 )
115+ . get ( '/200' ) . reply ( 200 )
116+
117+ return Promise . all ( [
118+ server . get ( '/proxy/?uri=https://example.org/404' ) . expect ( 404 ) ,
119+ server . get ( '/proxy/?uri=https://example.org/401' ) . expect ( 401 ) ,
120+ server . get ( '/proxy/?uri=https://example.org/500' ) . expect ( 500 ) ,
121+ server . get ( '/proxy/?uri=https://example.org/200' ) . expect ( 200 )
122+ ] )
135123 } )
136124
137125 it ( 'should work with cors' , ( done ) => {
0 commit comments