Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions lib/http-methods/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ require('dotenv').config();

const handleError = err => {
if (err.response && err.response.body) {
console.log(`==== line 7`);
console.log(err);
console.log('err.response.body:', err?.response?.body || 'undefined');

const body = JSON.parse(err.response.body);
const error = {
status: err.response.statusCode,
Expand Down Expand Up @@ -63,12 +67,19 @@ const postRequest = async (path, headers, data) => {
};

const patchRequest = async (path, headers, data) => {
console.log('=== patchRequest');
console.log('path:', path || 'undefined');
console.log('headers:', headers || 'undefined');
console.log('data:', data || 'undefined');

try {
const response = await got.patch(buildUrl(path), {
headers,
json: data,
});
if (response && response.body) {
console.log(`==== line 81`);
console.log(response.body);
return JSON.parse(response.body);
}
return { status: 'ok' };
Expand Down Expand Up @@ -105,7 +116,12 @@ const deleteRequest = async (path, headers) => {
};

const buildUrl = (path, searchParams = '') => {
console.log(path);
console.log(searchParams);

const url = process.env.LATITUDE_API_DOMAIN || 'https://api.latitude.sh';

console.log(url + path + searchParams);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Temporary debug logs: Codebase pollution.

Multiple console.log debugging statements were added throughout the file (in handleError, patchRequest, and buildUrl functions). These debug logs appear to be temporary debugging code that should not be committed to the codebase as they add noise to production logs and may leak sensitive information like headers and error details.

Fix in Cursor Fix in Web

return url + path + searchParams;
};

Expand Down