mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2025-12-19 05:47:46 +00:00
Fixed download pcap and jaeger trace when using fetch lib (#436)
* fixed cannot download pcap file * wip
This commit is contained in:
@@ -3,7 +3,7 @@ const basicAuth = (apiKey) => {
|
||||
const header = `Bearer ${apiKey}`;
|
||||
return {Authorization: header};
|
||||
};
|
||||
|
||||
const { Readable } = require('stream');
|
||||
const SEVEN_DAYS_IN_MS = (1000 * 3600 * 24 * 7);
|
||||
const HOMER_BASE_URL = process.env.HOMER_BASE_URL || 'http://127.0.0.1';
|
||||
|
||||
@@ -126,7 +126,7 @@ const getHomerPcap = async(logger, apiKey, callIds, method) => {
|
||||
logger.error({response}, 'Error retrieving messages');
|
||||
return;
|
||||
}
|
||||
return response.body;
|
||||
return Readable.fromWeb(response.body);
|
||||
} catch (err) {
|
||||
logger.info({err}, `getHomerPcap: Error retrieving messages for callid ${callIds}`);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ const getJaegerTrace = async(logger, traceId) => {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
const response = await fetch(`${JAEGER_BASE_URL}/api/traces/${traceId}`);
|
||||
const response = await fetch(`${JAEGER_BASE_URL}/api/v3/traces/${traceId}`);
|
||||
if (!response.ok) {
|
||||
logger.error({response}, 'Error retrieving spans');
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user