From db4b15f21fbf4e33434e930ffc7fb768cdcf9d42 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 8 Mar 2021 14:24:11 +0100 Subject: Use got instead of request --- server/controllers/api/search.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'server/controllers/api/search.ts') diff --git a/server/controllers/api/search.ts b/server/controllers/api/search.ts index 7e1b7b230..317b24fe9 100644 --- a/server/controllers/api/search.ts +++ b/server/controllers/api/search.ts @@ -1,6 +1,6 @@ import * as express from 'express' import { sanitizeUrl } from '@server/helpers/core-utils' -import { doRequest } from '@server/helpers/requests' +import { doJSONRequest } from '@server/helpers/requests' import { CONFIG } from '@server/initializers/config' import { getOrCreateVideoAndAccountAndChannel } from '@server/lib/activitypub/videos' import { AccountBlocklistModel } from '@server/models/account/account-blocklist' @@ -94,9 +94,9 @@ async function searchVideoChannelsIndex (query: VideoChannelsSearchQuery, res: e try { logger.debug('Doing video channels search index request on %s.', url, { body }) - const searchIndexResult = await doRequest>({ uri: url, body, json: true }) + const searchIndexResult = await doJSONRequest>(url, { json: body }) - return res.json(searchIndexResult.body) + return res.json(searchIndexResult) } catch (err) { logger.warn('Cannot use search index to make video channels search.', { err }) @@ -186,9 +186,9 @@ async function searchVideosIndex (query: VideosSearchQuery, res: express.Respons try { logger.debug('Doing videos search index request on %s.', url, { body }) - const searchIndexResult = await doRequest>({ uri: url, body, json: true }) + const searchIndexResult = await doJSONRequest>(url, { json: body }) - return res.json(searchIndexResult.body) + return res.json(searchIndexResult) } catch (err) { logger.warn('Cannot use search index to make video search.', { err }) -- cgit v1.2.3