Giter Club home page Giter Club logo

connect-cors's People

Contributors

antono avatar blakmatrix avatar mcolyer avatar tootallnate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

connect-cors's Issues

transfer ownership

If you don't plan to work on this project anymore, will you click on the admin button of the project and transfer ownership to one of the other forks?

Input origins object is modified by library to RegExp object

Hi, appreciate the library! We're using it with success, but one issue - the way you're using the input config object, config.origins is an input array that you're modifying by replacing the input strings with a RegExp object.

This would be fine except array objects are pass by reference, so if multiple node apps are sharing the same CORS settings object (we're doing this during unit tests)...once the next app tries to send the same settings object back into your library (where some of the strings have become RegExp objects), it results in this error:

TypeError: Object /^http:\/\/localhost:4003(:|$)/ has no method 'toLowerCase'
      at origin (/Users/mrobben/devproj/sold-backend/node_modules/connect-xcors/connect-cors.js:121:36)
      at Array.forEach (native)
      at create (/Users/mrobben/devproj/sold-backend/node_modules/connect-xcors/connect-cors.js:119:22)

I'm happy to fix this for you in one of 3 ways -

  1. duplicate the input settings object so you're always using your own object rather than what's passed
  2. use a different var for the regexp table of origins
  3. document this behavior so other people don't make the mistake of sending shared settings objects in expecting they won't get modified by the lib.

POST request payload

What's the correct way to read POST request payload? I'm using connect-xcors and I can't seem to find where POST payload is stored.

  var server = connect.createServer(
      connect.logger(),
      CORS(options),
      connect.bodyParser(), function(req,res) {
           var foo = req.body.foo; /* this is where bodyParser() stores the payload */
           res.end();
      }
 )

I first thought it was connect.bodyParser() that was messing with me but removing that didn't solve the issue. All help is appreciated.

AUTHORship

I'm going to fork this and put my name in an AUTHORS file at the root. It looks like the code is pretty much the same as when I pull requested it, with perhaps a few additional bug fixes... and at least one new bug - being translated to coffeescript ;-P

When I'm using it as a portfolio item I want to be able to show that I indeed had a major role in the creation of the module.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.