Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Add rootRequest in metadata (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
geneh committed Sep 30, 2019
1 parent 5a8de62 commit 0ac1107
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 33 deletions.
6 changes: 5 additions & 1 deletion lib/crawler.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,14 +377,18 @@ class Crawler {
throw new Error('Delete without metadata');
}
request.document._metadata = request.response._metadataTemplate;
if (request.context.history) {
request.document._metadata.rootRequest = request.context.history[0];
}
return Q(request);
}

const metadata = {
type: request.type,
url: request.url,
fetchedAt: moment.utc().toISOString(),
links: {}
links: {},
rootRequest: request.context.history ? request.context.history[0] : undefined,
};
if (request.response) {
if (request.response.headers) {
Expand Down
Loading

0 comments on commit 0ac1107

Please sign in to comment.