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

Proposing options.origin as a Promise. #44

Closed
wants to merge 2 commits into from

Conversation

rapzo
Copy link

@rapzo rapzo commented Nov 5, 2017

As it was pointed at L59

@codecov
Copy link

codecov bot commented Nov 5, 2017

Codecov Report

Merging #44 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #44   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines          54     54           
  Branches       19     19           
=====================================
  Hits           54     54
Impacted Files Coverage Δ
index.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6e22833...cb4fa53. Read the comment docs.

@rapzo rapzo mentioned this pull request Nov 13, 2017
@@ -48,7 +48,7 @@ app.use(cors());
* CORS middleware
*
* @param {Object} [options]
* - {String|Function(ctx)} origin `Access-Control-Allow-Origin`, default is request Origin header
* - {String|Function(ctx)|Promise} origin `Access-Control-Allow-Origin`, default is request Origin header

Choose a reason for hiding this comment

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

{String|Promise<string>} may be better

Copy link
Author

Choose a reason for hiding this comment

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

But that would be a breaking change wouldn't it? It supports functions as is.

Choose a reason for hiding this comment

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

promise is still function, right? aren't you upgrade it from synchronous normal function to promise?

if (typeof options.origin === 'function') {
// FIXME: origin can be promise
origin = options.origin(ctx);
return resolve(options.origin || requestOrigin);

Choose a reason for hiding this comment

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

seems it could be return resolve(requestOrigin)

Copy link
Author

Choose a reason for hiding this comment

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

That'd break one test.

Choose a reason for hiding this comment

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

@dead-horse shall we regard it as a break change and rewrite the ancient test? or do we still need to support normal function?

Copy link
Member

Choose a reason for hiding this comment

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

we should keep support normal function as well.

@marswong
Copy link

marswong commented Jan 12, 2018

@rapzo lgtm. could you rebase your comment :)

@dead-horse
Copy link
Member

I think we can rewrite this module by async function so it will be much clear. :)

@marswong
Copy link

sounds good. so async for version 3, promise for version 1 and 2?

@rapzo
Copy link
Author

rapzo commented Jan 13, 2018

@dead-horse yeah, i got that covered in #43

@rapzo
Copy link
Author

rapzo commented Feb 19, 2018

Ping

@rapzo
Copy link
Author

rapzo commented Feb 28, 2019

Gonna bury this PRs. This repo is dead.

@rapzo rapzo closed this Feb 28, 2019
@vanthome
Copy link

Really sad. @dead-horse can you maybe even provide a statement whether this project is really dead or you seek a new maintainer?

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.

None yet

4 participants