File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ it("should return no headers", async () => {
1717 await expect ( getHeaders ( "" , "command" , logger ) ) . resolves . toStrictEqual ( { } )
1818 await expect ( getHeaders ( "localhost" , " " , logger ) ) . resolves . toStrictEqual ( { } )
1919 await expect ( getHeaders ( " " , "command" , logger ) ) . resolves . toStrictEqual ( { } )
20+ await expect ( getHeaders ( "localhost" , "printf ''" , logger ) ) . resolves . toStrictEqual ( { } )
2021} )
2122
2223it ( "should return headers" , async ( ) => {
@@ -43,7 +44,6 @@ it("should error on malformed or empty lines", async () => {
4344 await expect ( getHeaders ( "localhost" , "printf ' =foo'" , logger ) ) . rejects . toMatch ( / M a l f o r m e d / )
4445 await expect ( getHeaders ( "localhost" , "printf 'foo =bar'" , logger ) ) . rejects . toMatch ( / M a l f o r m e d / )
4546 await expect ( getHeaders ( "localhost" , "printf 'foo foo=bar'" , logger ) ) . rejects . toMatch ( / M a l f o r m e d / )
46- await expect ( getHeaders ( "localhost" , "printf ''" , logger ) ) . rejects . toMatch ( / M a l f o r m e d / )
4747} )
4848
4949it ( "should have access to environment variables" , async ( ) => {
Original file line number Diff line number Diff line change @@ -59,6 +59,10 @@ export async function getHeaders(
5959 }
6060 throw new Error ( `Header command exited unexpectedly: ${ error } ` )
6161 }
62+ if ( ! result . stdout ) {
63+ // Allow no output for parity with the Coder CLI.
64+ return headers
65+ }
6266 const lines = result . stdout . replace ( / \r ? \n $ / , "" ) . split ( / \r ? \n / )
6367 for ( let i = 0 ; i < lines . length ; ++ i ) {
6468 const [ key , value ] = lines [ i ] . split ( / = ( .* ) / )
You can’t perform that action at this time.
0 commit comments