Skip to content

XHR#fetchText now returns Response#9567

Merged
jridgewell merged 3 commits intoampproject:masterfrom
jridgewell:xhr-fetchText-response
May 26, 2017
Merged

XHR#fetchText now returns Response#9567
jridgewell merged 3 commits intoampproject:masterfrom
jridgewell:xhr-fetchText-response

Conversation

@jridgewell
Copy link
Copy Markdown
Contributor

Partial for #9448.

@jridgewell jridgewell requested a review from cvializ May 25, 2017 21:36
@jridgewell jridgewell force-pushed the xhr-fetchText-response branch from 947a252 to ff8df67 Compare May 25, 2017 22:58
]).then(() => {
expect(fetchStub).to.be.calledTwice;
expect(results[0]).to.equal(TEST_RESPONSE);
expect(results[1]).to.equal(TEST_RESPONSE);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why not check that the values match TEST_RESPONSE?

Copy link
Copy Markdown
Contributor Author

@jridgewell jridgewell May 26, 2017

Choose a reason for hiding this comment

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

Just a duplicate of the test above.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

But I notice you don't call .then(res => res.text()) here, is that intentional? Is it not necessary for a POST? I believe checking the results matching the TEST_RESPONSE a second time for the POST method may catch unexpected behavior.

Copy link
Copy Markdown
Contributor Author

@jridgewell jridgewell May 26, 2017

Choose a reason for hiding this comment

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

Processing the response body isn't necessary for the request to happen.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ah makes sense

@jridgewell
Copy link
Copy Markdown
Contributor Author

Approval? 😛

@cvializ
Copy link
Copy Markdown
Contributor

cvializ commented May 26, 2017

LGTM

@jridgewell jridgewell merged commit 1d2f8fe into ampproject:master May 26, 2017
@jridgewell jridgewell deleted the xhr-fetchText-response branch May 26, 2017 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants