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

refactor(http): improve eTag() return type for string and Uint8Array inputs #5571

Merged
merged 6 commits into from
Jul 30, 2024

Conversation

kt3k
Copy link
Member

@kt3k kt3k commented Jul 29, 2024

Not completely sure this is a breaking change, but this PR improves the return type of eTag function. Now it returns Promise<string> if the input is string or Uint8Array.

related #5217

@github-actions github-actions bot added the http label Jul 29, 2024
Copy link

codecov bot commented Jul 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.11%. Comparing base (36bc450) to head (64dd642).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5571      +/-   ##
==========================================
- Coverage   96.49%   96.11%   -0.38%     
==========================================
  Files         465      465              
  Lines       37772    37766       -6     
  Branches     5580     5549      -31     
==========================================
- Hits        36447    36300     -147     
- Misses       1283     1424     +141     
  Partials       42       42              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good to see @std/testing/types being used to test overload signatures. We should probably do this more throughout the codebase.

http/etag.ts Outdated
Comment on lines 124 to 126
* Calculate an ETag for an entity. When the entity is a specific set of data
* it will be fingerprinted as a "strong" tag, otherwise if it is just file
* information, it will be calculated as a weak tag.
Copy link
Contributor

Choose a reason for hiding this comment

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

We should update the descriptions to orient themselves to their respective overloads.

@iuioiua
Copy link
Contributor

iuioiua commented Jul 30, 2024

I'd also change the title to something like "Improve overloads for eTag()". And I don't think this is a breaking change.

@kt3k kt3k changed the title BREAKING(http): better eTag return type for string and Uint8Array inputs fix(http): better eTag return type for string and Uint8Array inputs Jul 30, 2024
@kt3k kt3k changed the title fix(http): better eTag return type for string and Uint8Array inputs fix(http): better eTag return type for string and Uint8Array inputs Jul 30, 2024
Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

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

LGTM once these last nits are addressed.

http/etag.ts Outdated
* Calculate an ETag for an entity. When the entity is a specific set of data
* it will be fingerprinted as a "strong" tag, otherwise if it is just file
* information, it will be calculated as a weak tag.
* Calculate an ETag for string or Uint8Array entities. This returns a strong tag.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please clarify what you mean by "strong tag"?

http/etag.ts Outdated Show resolved Hide resolved
http/etag.ts Outdated Show resolved Hide resolved
@kt3k kt3k merged commit 912c6f0 into denoland:main Jul 30, 2024
12 checks passed
@iuioiua iuioiua changed the title fix(http): better eTag return type for string and Uint8Array inputs refactor(http): improve eTag return type for string and Uint8Array inputs Jul 30, 2024
@iuioiua iuioiua changed the title refactor(http): improve eTag return type for string and Uint8Array inputs refactor(http): improve eTag() return type for string and Uint8Array inputs Jul 30, 2024
@kt3k kt3k deleted the breaking-http-better-typing-for-etag branch November 20, 2024 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants