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: Allow responding with Blob or ArrayBuffer when responseType is blob #164

Merged
merged 2 commits into from
May 26, 2021

Conversation

offirgolan
Copy link
Contributor

Currently, when the responseType is blob the body must be a string which is then converted to a utf8 ArrayBuffer which doesn't work for binary data. This allows you to respond with either an ArrayBuffer (which will get converted into a Blob) or Blob.

@codecov
Copy link

codecov bot commented May 14, 2020

Codecov Report

Merging #164 into master will increase coverage by 0.25%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #164      +/-   ##
==========================================
+ Coverage   90.54%   90.80%   +0.25%     
==========================================
  Files          13       13              
  Lines         603      609       +6     
==========================================
+ Hits          546      553       +7     
+ Misses         57       56       -1     
Flag Coverage Δ
#unit 90.80% <33.33%> (+0.25%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
lib/fake-xhr/index.js 87.46% <33.33%> (+0.50%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e185e64...918464b. Read the comment docs.

@offirgolan
Copy link
Contributor Author

@mroderick supportsBlob is always false in index.test.js since those tests are running in node which means all the blob tests aren't even being executed. I feel like this might be a task for a separate PR...

Copy link
Member

@fearphage fearphage left a comment

Choose a reason for hiding this comment

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

Missing a test for the new error you added. Looks good otherwise.

lib/fake-xhr/index.js Show resolved Hide resolved
@stale
Copy link

stale bot commented Aug 29, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added stale and removed stale labels Aug 29, 2020
@fatso83 fatso83 added the pinned label Aug 31, 2020
@offirgolan offirgolan requested a review from fearphage September 7, 2020 02:52
@fatso83
Copy link
Contributor

fatso83 commented May 25, 2021

I don't understand why the added tests did not cover the lines it complains about. It seems to exactly hit those lines 🤔

@fatso83
Copy link
Contributor

fatso83 commented May 25, 2021

@offirgolan I just casually looked at pending PRs and found this. Do you have any idea why codecov reports the lines as not being covered? Your tests does seem to catch the exception, so ... ? I saw this was pushed a year ago, so about time it got merged 😃

@offirgolan
Copy link
Contributor Author

No clue @fatso83. I'd love to get this merged in and published though since I've seen multiple users of pollyjs running into this issue.

@offirgolan
Copy link
Contributor Author

Actually, @fatso83 check my comment above:

@mroderick supportsBlob is always false in index.test.js since those tests are running in node which means all the blob tests aren't even being executed. I feel like this might be a task for a separate PR...

@fatso83 fatso83 dismissed fearphage’s stale review May 26, 2021 18:41

Implemented test

@fatso83 fatso83 merged commit d6da025 into sinonjs:master May 26, 2021
@offirgolan offirgolan deleted the respond-with-blob branch November 30, 2021 01:27
@offirgolan
Copy link
Contributor Author

@fatso83 would it be possible to cut a release?

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.

3 participants