File tree Expand file tree Collapse file tree
plugins/power-pages/scripts/tests/integration Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,24 +28,35 @@ function makeSiteRoot(entityLogicalNames) {
2828 return root ;
2929}
3030
31- test ( 'integration transport mirrors makeRequest includeHeaders behavior' , async ( ) => {
32- const mock = await startMock ( [
31+ function startHeaderMock ( ) {
32+ return startMock ( [
3333 {
3434 method : 'GET' ,
3535 matcher : '/headers' ,
3636 headers : { 'x-test-header' : 'present' } ,
3737 body : { ok : true } ,
3838 } ,
3939 ] ) ;
40+ }
41+
42+ test ( 'integration transport omits response headers by default' , async ( ) => {
43+ const mock = await startHeaderMock ( ) ;
4044 try {
41- const withoutHeaders = await makeLocalRequest ( { url : `${ mock . baseUrl } /headers` } ) ;
42- assert . equal ( Object . hasOwn ( withoutHeaders , 'headers' ) , false ) ;
45+ const result = await makeLocalRequest ( { url : `${ mock . baseUrl } /headers` } ) ;
46+ assert . equal ( Object . hasOwn ( result , 'headers' ) , false ) ;
47+ } finally {
48+ await mock . close ( ) ;
49+ }
50+ } ) ;
4351
44- const withHeaders = await makeLocalRequest ( {
52+ test ( 'integration transport includes response headers when requested' , async ( ) => {
53+ const mock = await startHeaderMock ( ) ;
54+ try {
55+ const result = await makeLocalRequest ( {
4556 url : `${ mock . baseUrl } /headers` ,
4657 includeHeaders : true ,
4758 } ) ;
48- assert . equal ( withHeaders . headers [ 'x-test-header' ] , 'present' ) ;
59+ assert . equal ( result . headers [ 'x-test-header' ] , 'present' ) ;
4960 } finally {
5061 await mock . close ( ) ;
5162 }
You can’t perform that action at this time.
0 commit comments