component extends="org.lucee.cfml.test.LuceeTestCase" { function beforeAll() { variables.queryWithDataIn = Query( id: [ 1 , 2 , 3 ] ); } function run( testResults , testBox ) { describe( 'https request returns 200' , function() { describe( 'using http{}' , function() { it( 'when server uses a standard certificate' , function() { http result = 'rs' url = 'https://www.google.com' {} isResponseOk( rs ); }); it( 'when server uses an SNI certificate' , function() { http result = 'rs' url = 'https://sni.velox.ch' {} isResponseOk( rs ); }); it( 'when server uses an SNI certificate and host is specified in request' , function() { http result = 'rs' url = 'https://sni.velox.ch' { httpparam type = 'header' name = 'Host' value = 'sni.velox.ch'; } isResponseOk( rs ); }); }); describe( 'using new http()' , function() { it( 'when server uses a standard certificate' , function() { isResponseOk( new http(url='https://www.google.com').send().getPrefix() ); }); it( 'when server uses an SNI certificate' , function() { isResponseOk( new http(url='https://sni.velox.ch').send().getPrefix() ); }); it( 'when server uses an SNI certificate and host is specified in request' , function() { var rq = new http(url='https://sni.velox.ch'); rq.addParam( type = 'header', name = 'Host', value = 'sni.velox.ch' ); isResponseOk( rq.send().getPrefix() ); }); }); }); } function isResponseOk( rs ) { expect( arguments.rs ).toHaveKey( 'errordetail' ); expect( arguments.rs.errordetail ).toBe( '' ); expect( arguments.rs ).toHaveKey( 'status_code' ); expect( arguments.rs.status_code ).toBe( 200 ); } }