-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix detection of HTML accept header #1263
Conversation
Use built in ExpressJS methods for detecting HTML in the Accept header.
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. |
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 |
You okay with me adding supertest to send the HTTP requests? Seems a bit excessive for out needs. |
Have added tests |
@@ -239,7 +239,9 @@ EmberApp.prototype._processedAppTree = memoize(function() { | |||
var mergedAppWithoutStylesAndTemplates = remove(mergedApp, { | |||
paths: ['styles', 'templates'] | |||
}); | |||
|
|||
mergedAppWithoutStylesAndTemplates = remove(mergedAppWithoutStylesAndTemplates, { | |||
files: ['**/.hbs'] |
There was a problem hiding this comment.
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.
The tests look good (and using supertest for testing is fine), but they are failing on Travis. Can you take a look? |
Oops, sorry @rjackson - thanks for picking that up. Are the tests still failing on Travis? I can't see how to investigate. |
Ah, it's showing the link now. Will investigate... |
Strange, the build log finishes with Any ideas why it thinks these aren't completing? |
Ah there we go - WEIRD. Now it sees that they've passed :) |
Looks good now, can you squash the commits and add a changelog entry? |
…ources can still get through to the proxy
Fix detection of HTML accept header
Thank you!!! Glad to have this under test finally. |
Yep, it's a beautiful thing. Thank YOU :) |
👍 |
👍 |
Nice and fast as usual. You guy rocks 👍 |
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 becausereq.accepts('html')
returns true if theaccepts
header includes*/*
, so my API requests no longer go through the proxy. The XHR requests to my API don't accepttext/html
, so previously they would go through the proxy to the API.