From 5a91cada3a395452973d0a4d499af0eae5ede321 Mon Sep 17 00:00:00 2001 From: marcelo sousa <101582143+marcelo-sousa-mh@users.noreply.github.com> Date: Tue, 15 Jul 2025 17:29:23 -0300 Subject: [PATCH 1/2] chore: logs --- lib/http-methods/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/http-methods/index.js b/lib/http-methods/index.js index 6e5dd34..6e2278e 100644 --- a/lib/http-methods/index.js +++ b/lib/http-methods/index.js @@ -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); + const body = JSON.parse(err.response.body); const error = { status: err.response.statusCode, @@ -63,12 +67,19 @@ const postRequest = async (path, headers, data) => { }; const patchRequest = async (path, headers, data) => { + console.log('=== patchRequest'); + console.log(path); + console.log(headers); + console.log(data); + 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' }; @@ -105,6 +116,10 @@ const deleteRequest = async (path, headers) => { }; const buildUrl = (path, searchParams = '') => { + console.log(path); + console.log(searchParams); + console.log(url + path + searchParams); + const url = process.env.LATITUDE_API_DOMAIN || 'https://api.latitude.sh'; return url + path + searchParams; }; From 69d6d1df2554244c027302241bec0960759de84c Mon Sep 17 00:00:00 2001 From: marcelo sousa <101582143+marcelo-sousa-mh@users.noreply.github.com> Date: Tue, 15 Jul 2025 17:43:31 -0300 Subject: [PATCH 2/2] chore: log fix --- lib/http-methods/index.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/http-methods/index.js b/lib/http-methods/index.js index 6e2278e..5923e59 100644 --- a/lib/http-methods/index.js +++ b/lib/http-methods/index.js @@ -5,7 +5,7 @@ const handleError = err => { if (err.response && err.response.body) { console.log(`==== line 7`); console.log(err); - console.log(err.response.body); + console.log('err.response.body:', err?.response?.body || 'undefined'); const body = JSON.parse(err.response.body); const error = { @@ -68,9 +68,9 @@ const postRequest = async (path, headers, data) => { const patchRequest = async (path, headers, data) => { console.log('=== patchRequest'); - console.log(path); - console.log(headers); - console.log(data); + console.log('path:', path || 'undefined'); + console.log('headers:', headers || 'undefined'); + console.log('data:', data || 'undefined'); try { const response = await got.patch(buildUrl(path), { @@ -118,9 +118,10 @@ const deleteRequest = async (path, headers) => { const buildUrl = (path, searchParams = '') => { console.log(path); console.log(searchParams); - console.log(url + path + searchParams); const url = process.env.LATITUDE_API_DOMAIN || 'https://api.latitude.sh'; + + console.log(url + path + searchParams); return url + path + searchParams; };