Skip to content

Commit 24e7bcc

Browse files
Merge pull request #3032 from brendandburns/fix-log-pretty-option
Fix pretty option for pod log requests
2 parents 8a4a943 + e183e69 commit 24e7bcc

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎src/log.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export function AddOptionsToSearchParams(
6464
if (options?.limitBytes) {
6565
searchParams.set('limitBytes', options.limitBytes.toString());
6666
}
67-
searchParams.set('pretty', options?.follow?.toString() || 'false');
67+
searchParams.set('pretty', options?.pretty?.toString() || 'false');
6868
searchParams.set('previous', options?.previous?.toString() || 'false');
6969
if (options?.sinceSeconds) {
7070
searchParams.set('sinceSeconds', options?.sinceSeconds?.toString() || 'false');

‎src/log_test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('Log', () => {
6262
},
6363
});
6464
const options: LogOptions = {
65-
follow: true,
65+
follow: false,
6666
limitBytes: 100,
6767
pretty: true,
6868
previous: true,
@@ -73,7 +73,7 @@ describe('Log', () => {
7373

7474
pool.intercept({
7575
method: 'GET',
76-
path: '/api/v1/namespaces/default/pods/mypod/log?container=mycontainer&follow=true&limitBytes=100&pretty=true&previous=true&sinceSeconds=1&tailLines=1&timestamps=true',
76+
path: '/api/v1/namespaces/default/pods/mypod/log?container=mycontainer&follow=false&limitBytes=100&pretty=true&previous=true&sinceSeconds=1&tailLines=1&timestamps=true',
7777
}).reply(200, 'log data');
7878

7979
const controller = await log.log(namespace, podName, containerName, stream, options);
@@ -188,7 +188,7 @@ describe('Log', () => {
188188
it('should add options to search params', () => {
189189
let searchParams = new URLSearchParams();
190190
let options: LogOptions = {
191-
follow: true,
191+
follow: false,
192192
limitBytes: 100,
193193
pretty: true,
194194
previous: true,
@@ -197,7 +197,7 @@ describe('Log', () => {
197197
timestamps: true,
198198
};
199199
AddOptionsToSearchParams(options, searchParams);
200-
strictEqual(searchParams.get('follow'), 'true');
200+
strictEqual(searchParams.get('follow'), 'false');
201201
strictEqual(searchParams.get('limitBytes'), '100');
202202
strictEqual(searchParams.get('pretty'), 'true');
203203
strictEqual(searchParams.get('previous'), 'true');

0 commit comments

Comments
 (0)