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

feat(merge-reports): ability to pass headers for databaseUrls.json files #527

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

DudaGod
Copy link
Member

@DudaGod DudaGod commented Jan 15, 2024

Add the ability to send headers for download databaseUrls.json files

const [key, ...values] = header.split('=');
return _.set(acc, key, values.join('='));
}, {});
const parsedHeaders = {...headersFromCli, ...headersFromEnv};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хедеры из переменной окружения имеют больший приоритет.

try {
headersFromEnv = JSON.parse(process.env.html_reporter_headers || '{}');
} catch (e) {
throw new Error(`Couldn't parse headers from "html_reporter_headers" env variable: ${e.message}`);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно докидывать понятное сообщение о ошибке иначе будет отображаться стандартная ошибка из json.parse (нефига не понятная)

@@ -63,7 +63,7 @@
"dependencies": {
"@babel/runtime": "^7.22.5",
"@gemini-testing/sql.js": "^2.0.0",
"axios": "^0.18.1",
"axios": "^1.6.5",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Заодно апнул версию axios (по идее проблем быть не должно)

@DudaGod DudaGod force-pushed the HERMIONE-1330.merge_reports_send_headers branch from 54ba855 to 0ba9568 Compare January 15, 2024 15:30
const jsonUrls = [];
const dbUrls = [];

if (serverUtils.isDbUrl(url)) {
dbUrls.push(url);
} else if (serverUtils.isJsonUrl(url)) {
try {
const {data} = await axios.get(url);
console.log('headers:', headers);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

забыл?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

да, поправил

@DudaGod DudaGod force-pushed the HERMIONE-1330.merge_reports_send_headers branch from 0ba9568 to 2c7a19b Compare January 17, 2024 08:28
@DudaGod DudaGod force-pushed the HERMIONE-1330.merge_reports_send_headers branch from 2c7a19b to a367122 Compare January 17, 2024 08:46
@DudaGod DudaGod merged commit e6db7b9 into master Jan 17, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants