Aaron Ji commited on
Commit
3d29b30
·
unverified ·
1 Parent(s): 51109e0

fix: use 'no-content' (#1154)

Browse files

* fix: use 'no-content' in x-respond-with

* fix: use 'no-content' in x-respond-with

backend/functions/src/cloud-functions/searcher-serper.ts CHANGED
@@ -91,7 +91,7 @@ export class SearcherHost extends RPCHost {
91
  const uid = await auth.solveUID();
92
  // Return content by default
93
  const respondWith = ctx.req.get('X-Respond-With') ?? 'content';
94
- const crawlWithoutContent = !respondWith.includes('content');
95
 
96
  let chargeAmount = 0;
97
  const noSlashPath = decodeURIComponent(ctx.req.path).slice(1);
@@ -352,7 +352,7 @@ export class SearcherHost extends RPCHost {
352
  if (withContent) {
353
  result.content = ['html', 'text', 'screenshot'].includes(mode) ? undefined : '';
354
  }
355
- if (mode.includes('favicon')) {
356
  const url = new URL(upstreamSearchResult.link);
357
  result.favicon = await this.getFavicon(url.origin);
358
  dataItems.push({
 
91
  const uid = await auth.solveUID();
92
  // Return content by default
93
  const respondWith = ctx.req.get('X-Respond-With') ?? 'content';
94
+ const crawlWithoutContent = respondWith.includes('no-content');
95
 
96
  let chargeAmount = 0;
97
  const noSlashPath = decodeURIComponent(ctx.req.path).slice(1);
 
352
  if (withContent) {
353
  result.content = ['html', 'text', 'screenshot'].includes(mode) ? undefined : '';
354
  }
355
+ if (mode.includes('no-content')) {
356
  const url = new URL(upstreamSearchResult.link);
357
  result.favicon = await this.getFavicon(url.origin);
358
  dataItems.push({