-
Notifications
You must be signed in to change notification settings - Fork 145
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
Enhancements to options.middleware
#85
Conversation
Hello @steve-jansen, thanks for the PR. Could you rebase your PR and don't bump the version for us. |
Hi @vladikoff, no problem. Just pushed a commit to revert the version bump in CHANGELOG and package.json. For some reason GitHub picked up the new commit but Travis did not (yet). Let me know if I did something wrong with Travis. |
Could you squash your commits into one? Thanks! |
Hi @vladikoff, just pushed a squashed commit. I prefer squashed commits too, but, wasn't sure if that was kosher since I had pushed my commits to origin. Thinking about it now, it makes sense that squashing and force pushing to my fork wouldn't harm the mainline repo. Learn something new everyday! |
Oh seems like you still need to git rebase from current master. |
- modified options.middleware to accept an array or a function - modified the arguments sent to the options.middleware function to include a third argument that is the array of default middlewares - added unit tests for https use cases and new options.middleware use cases - refactored unit tests and the test case configs in Gruntfile.js to use a sequential set of TCP port numbers, starting at 8000, for clarity
Hi @vladikoff, you have been busy today! Just rebased from the upstream master and pushed again. Travis is now building successfully; guess Travis needs automatic merging to kick off a build against a pull request. |
@@ -35,18 +35,21 @@ module.exports = function(grunt) { | |||
}, | |||
custom_port: { | |||
options: { | |||
port: 9000, | |||
base: 'test', | |||
port: 8001, |
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.
Why did you have to update all of these?
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.
Starting at 8000 was purely an arbitrary decision to sequentially number the ports to make it obvious when a server was running on a port yet no tests were being made against that server instance.
If you look at the 0fc962 test/connect_test.js#L24-83 and 0fc962 Gruntfile.js#L37-90, you will see 7 servers but only 4 test suites, with a mix of ports in the 8000 and 9000 ranges.
Thanks for rebasing the PR. You changed the port from 9xxx to 8xxx, what's the reason for this? |
commit 1609f28b8033b24aeb9d8ac01bbbfca43a3cd7b3 Author: Steve Jansen <stevejansen_github@icloud.com> Date: Wed Feb 19 14:35:16 2014 -0500 enhance options.middleware to pass the default middleware as an arg - modified options.middleware to accept an array or a function - modified the arguments sent to the options.middleware function to include a third argument that is the array of default middlewares - added unit tests for https use cases and new options.middleware use cases - refactored unit tests and the test case configs in Gruntfile.js to use a sequential set of TCP port numbers, starting at 8000, for clarity Closes gh-85.
Changelog: * update to http-proxy@1.1.x; http-proxy@1.0 was a "from-scratch" implementation of the proxy core by nodejitsu, leaving http-proxy@0.x no longer supported * implements support for use as grunt middleware; includes examples for running a proxy url inside `grunt serve` see gruntjs/grunt-contrib-connect#85 * implements support for proxying to SSL/TLS endpoints * implements support for connecting to HTTP proxy gateways on the LAN that require basic authentication credentials * general housekeeping: added unit tests, resolved jshint issues
Changelog: * update to http-proxy@1.1.x; http-proxy@1.0 was a "from-scratch" implementation of the proxy core by nodejitsu, leaving http-proxy@0.x no longer supported * implements support for use as grunt middleware; includes examples for running a proxy url inside `grunt serve` see gruntjs/grunt-contrib-connect#85 * implements support for proxying to SSL/TLS endpoints * implements support for connecting to HTTP proxy gateways on the LAN that require basic authentication credentials * general housekeeping: added unit tests, resolved jshint issues
Hi,
I'm the author of a developer utility called json-proxy and love grunt! I noticed recently my documentation for injecting json-proxy as middleware into grunt-contrib-connect no longer worked properly with Yeoman.io templates.
I realized that users are copying the default middlewares function from connect.js#L31-45.
This seems really fragile, and awkward for users. See drewzboto/grunt-connect-proxy#29 as an example.
So, I enhanced the
options.middleware
logic to maintain backwards compatibility yet make life easier for extending the default middlewares:I included passing nodeunit tests and updated the relevant docs. I also refactored the tests to include coverage for HTTPS use cases (which I believe other PRs may address as well; figured it was worth fixing while I was in the codebase). Finally, I reconfigured the test cases to use a sequential set of ports starting at TCP port 8000.
Enjoy!
Steve