diff options
author | Chocobozzz <me@florianbigard.com> | 2021-03-08 14:24:11 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-03-24 18:18:40 +0100 |
commit | db4b15f21fbf4e33434e930ffc7fb768cdcf9d42 (patch) | |
tree | 418117b84a5c2ee578c210288b698d155422d608 /server/controllers | |
parent | 71926aae0762facb25243f27eaf45933b5a37353 (diff) | |
download | PeerTube-db4b15f21fbf4e33434e930ffc7fb768cdcf9d42.tar.gz PeerTube-db4b15f21fbf4e33434e930ffc7fb768cdcf9d42.tar.zst PeerTube-db4b15f21fbf4e33434e930ffc7fb768cdcf9d42.zip |
Use got instead of request
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/search.ts | 10 |
1 files changed, 5 insertions, 5 deletions
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 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { sanitizeUrl } from '@server/helpers/core-utils' | 2 | import { sanitizeUrl } from '@server/helpers/core-utils' |
3 | import { doRequest } from '@server/helpers/requests' | 3 | import { doJSONRequest } from '@server/helpers/requests' |
4 | import { CONFIG } from '@server/initializers/config' | 4 | import { CONFIG } from '@server/initializers/config' |
5 | import { getOrCreateVideoAndAccountAndChannel } from '@server/lib/activitypub/videos' | 5 | import { getOrCreateVideoAndAccountAndChannel } from '@server/lib/activitypub/videos' |
6 | import { AccountBlocklistModel } from '@server/models/account/account-blocklist' | 6 | import { AccountBlocklistModel } from '@server/models/account/account-blocklist' |
@@ -94,9 +94,9 @@ async function searchVideoChannelsIndex (query: VideoChannelsSearchQuery, res: e | |||
94 | try { | 94 | try { |
95 | logger.debug('Doing video channels search index request on %s.', url, { body }) | 95 | logger.debug('Doing video channels search index request on %s.', url, { body }) |
96 | 96 | ||
97 | const searchIndexResult = await doRequest<ResultList<VideoChannel>>({ uri: url, body, json: true }) | 97 | const searchIndexResult = await doJSONRequest<ResultList<VideoChannel>>(url, { json: body }) |
98 | 98 | ||
99 | return res.json(searchIndexResult.body) | 99 | return res.json(searchIndexResult) |
100 | } catch (err) { | 100 | } catch (err) { |
101 | logger.warn('Cannot use search index to make video channels search.', { err }) | 101 | logger.warn('Cannot use search index to make video channels search.', { err }) |
102 | 102 | ||
@@ -186,9 +186,9 @@ async function searchVideosIndex (query: VideosSearchQuery, res: express.Respons | |||
186 | try { | 186 | try { |
187 | logger.debug('Doing videos search index request on %s.', url, { body }) | 187 | logger.debug('Doing videos search index request on %s.', url, { body }) |
188 | 188 | ||
189 | const searchIndexResult = await doRequest<ResultList<Video>>({ uri: url, body, json: true }) | 189 | const searchIndexResult = await doJSONRequest<ResultList<Video>>(url, { json: body }) |
190 | 190 | ||
191 | return res.json(searchIndexResult.body) | 191 | return res.json(searchIndexResult) |
192 | } catch (err) { | 192 | } catch (err) { |
193 | logger.warn('Cannot use search index to make video search.', { err }) | 193 | logger.warn('Cannot use search index to make video search.', { err }) |
194 | 194 | ||