Skip to content

Commit

Permalink
Added query and operator on redirect return (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrsmutti authored Jan 9, 2020
1 parent 098b23d commit 5b78a04
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Added

- Query and operator info on redirect return.

## [0.4.0] - 2019-12-27

### Added
Expand Down
12 changes: 9 additions & 3 deletions node/clients/biggy-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,19 @@ export class BiggySearchClient extends ExternalClient {

return result || { products: [] };
} catch (err) {
let redirect: string | undefined;
if (path(["response", "status"], err) === 302) {
const redirect = path(["response", "headers", "location"], err);
return { redirect, products: [] };
redirect = path(["response", "headers", "location"], err);
}

// TODO: Add logging
return { products: [] };
return {
redirect,
query,
operator: operator || "and",
total: 0,
products: [],
};
}
}
}

0 comments on commit 5b78a04

Please sign in to comment.