fix: included query params in redirecting to prefix 0x in tx endpoint (#1205)

This commit is contained in:
M Hassan Tariq
2022-06-21 20:43:17 +05:00
committed by GitHub
parent fcc7025fd9
commit 664cce744d

View File

@@ -240,7 +240,9 @@ export function createTxRouter(db: PgStore): express.Router {
asyncHandler(async (req, res, next) => {
const { tx_id } = req.params;
if (!has0xPrefix(tx_id)) {
return res.redirect('/extended/v1/tx/0x' + tx_id);
const baseURL = req.protocol + '://' + req.headers.host + '/';
const url = new URL(req.url, baseURL);
return res.redirect('/extended/v1/tx/0x' + tx_id + url.search);
}
const eventLimit = parseTxQueryEventsLimit(req.query['event_limit'] ?? 96);