File tree Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 2020 image : existdb/existdb:${{ matrix.exist-version }}
2121 ports :
2222 - 8443:8443
23+ - 8080:8080
2324 volumes :
2425 - ${{ github.workspace }}/xquery:/exist/autodeploy
2526 options : >-
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ const defaultRPCoptions = {
3232
3333const defaultRestOptions = {
3434 host : 'localhost' ,
35- protocol : 'https' ,
35+ protocol : 'https: ' ,
3636 port : '8443' ,
3737 path : '/exist/rest' ,
3838 basic_auth : {
@@ -104,7 +104,7 @@ async function restConnection (options) {
104104
105105 const port = _options . port ? ':' + _options . port : ''
106106 const path = _options . path . startsWith ( '/' ) ? _options . path : '/' + _options . path
107- const prefixUrl = `${ _options . protocol } : //${ _options . host } ${ port } ${ path } `
107+ const prefixUrl = `${ _options . protocol } //${ _options . host } ${ port } ${ path } `
108108
109109 const client = got . extend (
110110 {
Original file line number Diff line number Diff line change @@ -382,3 +382,33 @@ return $r
382382 unlinkSync ( 'stream-test.xml' )
383383 } )
384384} )
385+
386+ test . only ( 'with rest client over http' , async function ( t ) {
387+ const modifiedOptions = Object . assign ( { protocol : 'http:' , port : '8080' } , envOptions )
388+ const rc = await getRestClient ( modifiedOptions )
389+
390+ t . test ( 'non-existent file returns 404' , async function ( st ) {
391+ try {
392+ const res = await rc . get ( 'db/rest-test/non-existent.file' )
393+ st . fail ( res )
394+ st . end ( )
395+ } catch ( e ) {
396+ st . equal ( e . response . statusCode , 404 )
397+ st . end ( )
398+ }
399+ } )
400+
401+ t . test ( 'getting a collection will return the file listing as xml' , async function ( st ) {
402+ try {
403+ const res = await rc . get ( 'db' )
404+ st . equal ( res . statusCode , 200 , 'server responded with status ' + res . statusCode )
405+
406+ const lines = res . body . split ( '\n' )
407+ st . equal ( lines [ 0 ] , '<exist:result xmlns:exist="http://exist.sourceforge.net/NS/exist">' )
408+ st . end ( )
409+ } catch ( e ) {
410+ st . fail ( e )
411+ st . end ( )
412+ }
413+ } )
414+ } )
You can’t perform that action at this time.
0 commit comments