Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/hitide profile 58 - change harmony submit to POST #35

Merged
merged 9 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
### Changed
- issue-58: Changed harmony submit call from GET to POST.
### Removed
### Fixed

Expand Down
16 changes: 6 additions & 10 deletions server/client/harmony.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,11 @@ async function subset(job, accessToken) {
const {
datasetId,
bbox,
searchStartDate,
searchEndDate,
granuleIds = [],
granuleNames = [],
variables,
merge
} = job.subjobs[0];
const [west, south, east, north] = bbox.split(",");
//const startDate = startOfDay(searchStartDate);
//const endDate = endOfDay(searchEndDate);

let variablesString = variables || "all";
if (Array.isArray(variables)) variablesString = variables.join(",");
Expand All @@ -27,13 +22,12 @@ async function subset(job, accessToken) {
url += `&skipPreview=true`;
url += `&subset=lat(${south}:${north})`;
url += `&subset=lon(${west}:${east})`;
//url += `&subset=time("${startDate}":"${endDate}")`;

// add granule names
granuleNames.forEach((granuleName) => {
url += `&granuleName=${granuleName}`;
});
const formData = new FormData();

granuleIds.forEach((granuleId) => {
url += `&granuleId=${granuleId}`;
formData.append("granuleId", granuleId);
});
if(merge) url += `&concatenate=true`;

Expand All @@ -42,9 +36,11 @@ async function subset(job, accessToken) {
let response, text;
try {
response = await fetch(url, {
method: 'POST',
headers: {
Authorization: `Bearer ${accessToken}`,
},
body: formData
});
text = await response.text();
} catch (error) {
Expand Down
Loading