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

Fix Content-length on httpApiCall #250

Merged
merged 10 commits into from
Apr 26, 2024

Conversation

timursevimli
Copy link
Member

#234

  • tests and linter show no problems (npm t)
  • tests are added/updated for bug fixes and new features
  • code is properly formatted (npm run fmt)
  • description of changes is added in CHANGELOG.md
  • update .d.ts typings

Copy link
Member

@tshemsedinov tshemsedinov left a comment

Choose a reason for hiding this comment

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

I do not think we need to extract customHeaders as a separate function

@timursevimli
Copy link
Member Author

I agree with you and I don't really like this approach either, but then we won't be able to test it

lib/network.js Outdated
if (body) headers['Content-Length'] = Buffer.byteLength(body);
const options = { method, headers: custom, body };
return await fetch(url, options).then(async (res) => {
headers['Content-Type'] = mimeType;
Copy link
Member

Choose a reason for hiding this comment

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

This will change incoming arguments

lib/network.js Outdated Show resolved Hide resolved
test/network.js Outdated Show resolved Hide resolved
test/network.js Outdated Show resolved Hide resolved
test/network.js Outdated Show resolved Hide resolved
test/network.js Outdated Show resolved Hide resolved
@tshemsedinov tshemsedinov merged commit a9563db into metarhia:master Apr 26, 2024
1 of 10 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.

None yet

2 participants