Fix curl -s

This commit is contained in:
Alex Gleason committed 2025-10-18 12:45:16 -05:00
1 parent c1dcfd5b7f
commit 0bd86b28ac
2 files changed
+7 -9

No files matched your search

+5 -3
View File
@@ -190,7 +190,7 @@ describe('CurlCommand', () => {
expect(result.stdout).toContain('100 12 100 12');
});
it('should be silent when -s flag is used', async () => {
it('should still output response body when -s flag is used', async () => {
const mockResponse = {
ok: true,
status: 200,
@@ -205,7 +205,7 @@ describe('CurlCommand', () => {
const result = await curlCommand.execute(['-s', 'https://example.com'], '/test');
expect(result.exitCode).toBe(0);
expect(result.stdout).toBe('');
expect(result.stdout).toBe('Hello World');
});
it('should handle HTTP error responses', async () => {
@@ -272,7 +272,9 @@ describe('CurlCommand', () => {
const result = await curlCommand.execute(['-si', 'https://example.com'], '/test');
expect(result.exitCode).toBe(0);
expect(result.stdout).toBe(''); // Silent mode
// Silent mode still shows response body and headers (when -i is used)
expect(result.stdout).toContain('HTTP/1.1 200 OK');
expect(result.stdout).toContain('Hello World');
});
it('should handle write-out format', async () => {
+2 -6
View File
@@ -171,14 +171,10 @@ export class CurlCommand implements ShellCommand {
// Handle write-out format
if (options.writeOut) {
const writeOutResult = this.formatWriteOut(options.writeOut, response, responseText);
if (options.silent) {
return createSuccessResult(writeOutResult);
} else {
output += '\n' + writeOutResult;
}
output += '\n' + writeOutResult;
}
return createSuccessResult(options.silent ? '' : output);
return createSuccessResult(output);
} catch (error) {
if (timeoutId) {