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

Fix detection of HTML accept header #1263

Merged
merged 1 commit into from
Jul 7, 2014

Conversation

simonexmachina
Copy link
Contributor

Fix detection of HTML accept header so that requests for non-HTML resources can still get through to the proxy.

This commit broke the --proxy feature because req.accepts('html') returns true if the accepts header includes */*, so my API requests no longer go through the proxy. The XHR requests to my API don't accept text/html, so previously they would go through the proxy to the API.

simonexmachina referenced this pull request Jul 4, 2014
Use built in ExpressJS methods for detecting HTML in the Accept header.
@stefanpenner
Copy link
Contributor

i knows it's a pain but do you think u can add a test here? This will help us prevent chasing our own tail we keep trolling ourselves by breaking the proxy.

@stefanpenner
Copy link
Contributor

i starting going down the path of some proxy test stuff, but never had time time to actually finish it: https://github.com/stefanpenner/ember-cli/blob/master/tests/unit/tasks/server/express-server-test.js#L51

@simonexmachina
Copy link
Contributor Author

You okay with me adding supertest to send the HTTP requests? Seems a bit excessive for out needs.

@simonexmachina
Copy link
Contributor Author

Have added tests

@@ -239,7 +239,9 @@ EmberApp.prototype._processedAppTree = memoize(function() {
var mergedAppWithoutStylesAndTemplates = remove(mergedApp, {
paths: ['styles', 'templates']
});

mergedAppWithoutStylesAndTemplates = remove(mergedAppWithoutStylesAndTemplates, {
files: ['**/.hbs']
Copy link
Member

Choose a reason for hiding this comment

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

Looks like the changes from the other PR snuck in here.

@rwjblue
Copy link
Member

rwjblue commented Jul 7, 2014

The tests look good (and using supertest for testing is fine), but they are failing on Travis. Can you take a look?

@simonexmachina
Copy link
Contributor Author

Oops, sorry @rjackson - thanks for picking that up. Are the tests still failing on Travis? I can't see how to investigate.

@simonexmachina
Copy link
Contributor Author

Ah, it's showing the link now. Will investigate...

@simonexmachina
Copy link
Contributor Author

Strange, the build log finishes with The command "npm run-script test-all" exited with 0. for node 0.10.18 and 0.11, but they're both not "finished". Node 0.10.26 is fine.

Any ideas why it thinks these aren't completing?

@simonexmachina
Copy link
Contributor Author

Ah there we go - WEIRD. Now it sees that they've passed :)

@rwjblue
Copy link
Member

rwjblue commented Jul 7, 2014

Looks good now, can you squash the commits and add a changelog entry?

rwjblue added a commit that referenced this pull request Jul 7, 2014
@rwjblue rwjblue merged commit d3b4bcb into ember-cli:master Jul 7, 2014
@rwjblue
Copy link
Member

rwjblue commented Jul 7, 2014

Thank you!!! Glad to have this under test finally.

@simonexmachina
Copy link
Contributor Author

Yep, it's a beautiful thing. Thank YOU :)​

@simonexmachina simonexmachina deleted the fix-html-header-detection branch July 7, 2014 14:31
@stefanpenner
Copy link
Contributor

👍

@rwjblue rwjblue mentioned this pull request Jul 7, 2014
@ashrafhasson
Copy link

👍

@Titinux
Copy link

Titinux commented Jul 7, 2014

Nice and fast as usual. You guy rocks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants