Skip to content

Commit 861491a

Browse files
committed
Fix header parsing & failing test.
1 parent 621d759 commit 861491a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default typeof fetch=='function' ? fetch : function(url, options) {
2222
keys = [],
2323
all = [],
2424
headers = {},
25-
reg = /^(.*?):\s*([\s\S]*)$/gm,
25+
reg = /^(.*?):\s*([\s\S]*?)$/gm,
2626
match, header, key;
2727

2828
while ((match=reg.exec(headerText))) {

test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('unfetch', () => {
4444

4545
expect(xhr.setRequestHeader).to.have.been.calledOnce.and.calledWith('a', 'b');
4646
expect(xhr.open).to.have.been.calledOnce.and.calledWith('get', '/foo');
47-
expect(xhr.send).to.have.been.calledOnce.and.calledWith(null);
47+
expect(xhr.send).to.have.been.calledOnce.and.calledWith();
4848

4949
delete global.XMLHttpRequest;
5050
});

0 commit comments

Comments
 (0)