mirror of
https://github.com/alexgo-io/stacks-blockchain-api.git
synced 2026-01-12 22:43:34 +08:00
fix: transaction broadcast log
This commit is contained in:
@@ -220,6 +220,12 @@ export function createCoreNodeRpcProxyRouter(db: DataStore): express.Router {
|
||||
proxyResp.headers.forEach((value, name) => {
|
||||
res.setHeader(name, value);
|
||||
});
|
||||
if (proxyResp.status === 200) {
|
||||
// Log the transaction id broadcast, but clone the `Response` first before parsing its body
|
||||
// so we don't mess up the original response's `ReadableStream` pointers.
|
||||
const parsedTxId: string = await proxyResp.clone().json();
|
||||
await logTxBroadcast(parsedTxId);
|
||||
}
|
||||
await pipelineAsync(proxyResp.body, res);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -50,7 +50,8 @@ describe('v2-proxy tests', () => {
|
||||
return [apiServer, apiServer.terminate] as const;
|
||||
},
|
||||
async (_, __, api) => {
|
||||
const primaryStubbedResponse = 'success stubbed response';
|
||||
const primaryStubbedResponse =
|
||||
'"1659fcdc9167576eb1f2a05d0aaba5ca1aa1943892e7e6e5d3ccb3e537f1c870"';
|
||||
const extraStubbedResponse = 'extra success stubbed response';
|
||||
const testRequest = 'fake-tx-data';
|
||||
let mockedRequestBody = 'none';
|
||||
|
||||
Reference in New Issue
Block a user