nomagick commited on
Commit
a9855dc
·
unverified ·
1 Parent(s): cf01a2c

chore: prefer ctx.URL

Browse files
Files changed (1) hide show
  1. src/api/crawler.ts +2 -3
src/api/crawler.ts CHANGED
@@ -228,9 +228,8 @@ export class CrawlerHost extends RPCHost {
228
  let chargeAmount = 0;
229
  const crawlerOptions = ctx.method === 'GET' ? crawlerOptionsHeaderOnly : crawlerOptionsParamsAllowed;
230
 
231
- // ctx.url in Koa is still not a real URL, just the full path including search query.
232
- // ctx.path in Koa does not include the search query.
233
- const targetUrl = await this.getTargetUrl(tryDecodeURIComponent(ctx.url), crawlerOptions);
234
  if (!targetUrl) {
235
  return await this.getIndex(auth);
236
  }
 
228
  let chargeAmount = 0;
229
  const crawlerOptions = ctx.method === 'GET' ? crawlerOptionsHeaderOnly : crawlerOptionsParamsAllowed;
230
 
231
+ // Use koa ctx.URL, a standard URL object to avoid node.js framework prop naming confusion
232
+ const targetUrl = await this.getTargetUrl(tryDecodeURIComponent(`${ctx.URL.pathname}${ctx.URL.search}`), crawlerOptions);
 
233
  if (!targetUrl) {
234
  return await this.getIndex(auth);
235
  }