feat(woof): add WOOF easter egg (#8301)

* feat(woof): add WOOF easter egg

* refactor(woof): extract WOOF response logic into a separate utility function

* refactor: rename the response function
This commit is contained in:
sanish chirayath
2026-06-24 16:46:18 +05:30
committed by GitHub
parent 42e9c9a309
commit 7765320aa5
2 changed files with 45 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ const { cookiesStore } = require('../../store/cookies');
const registerGrpcEventHandlers = require('./grpc-event-handlers');
const { registerWsEventHandlers } = require('./ws-event-handlers');
const { getCertsAndProxyConfig, buildCertsAndProxyConfig } = require('./cert-utils');
const { easterEggResponse } = require('../../utils/woof');
const { buildFormUrlEncodedPayload, isFormData, extractBoundaryFromContentType } = require('@usebruno/common').utils;
const ERROR_OCCURRED_WHILE_EXECUTING_REQUEST = 'Error occurred while executing the request!';
@@ -873,6 +874,12 @@ const registerNetworkIpc = (mainWindow) => {
const abortController = new AbortController();
const request = await prepareRequest(item, collection, abortController);
// Every good boy deserves a response.
if (request.method && request.method.toUpperCase() === 'WOOF') {
return easterEggResponse(request);
}
request.__bruno__executionMode = 'standalone';
request.responseType = 'stream';
// flag to see if the stream needs to be handled as an actual stream or

View File

@@ -0,0 +1,38 @@
const easterEggResponse = (request) => {
const woofStart = Date.now();
const body = [
'Woof! Woof!',
'',
' __',
' (___()\'`;',
' /, /`',
' \\\\"--\\\\',
'',
'Bruno fetched your request. Good human.'
].join('\n');
const buffer = Buffer.from(body, 'utf-8');
return {
status: 200,
statusText: 'Woof!',
headers: {
'content-type': 'text/plain; charset=utf-8',
'x-good-boy': 'true',
'x-fetched-by': 'bruno'
},
data: body,
dataBuffer: buffer.toString('base64'),
size: buffer.byteLength,
duration: Date.now() - woofStart,
url: request.url,
timeline: [],
requestSent: {
url: request.url,
method: 'WOOF',
headers: request.headers,
data: null,
timestamp: woofStart
}
};
};
module.exports = { easterEggResponse };