Skip to content

feat: Allow responding with Blob or ArrayBuffer when responseType is blob#164

Merged
fatso83 merged 2 commits into
sinonjs:masterfrom
offirgolan:respond-with-blob
May 26, 2021
Merged

feat: Allow responding with Blob or ArrayBuffer when responseType is blob#164
fatso83 merged 2 commits into
sinonjs:masterfrom
offirgolan:respond-with-blob

Conversation

@offirgolan

Copy link
Copy Markdown
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

codecov Bot commented May 14, 2020

Copy link
Copy Markdown

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
Copy Markdown
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...

@fearphage fearphage left a comment

Copy link
Copy Markdown
Member

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.

Comment thread lib/fake-xhr/index.js
@stale

stale Bot commented Aug 29, 2020

Copy link
Copy Markdown

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

fatso83 commented May 25, 2021

Copy link
Copy Markdown
Contributor

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

@fatso83

fatso83 commented May 25, 2021

Copy link
Copy Markdown
Contributor

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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