-
-
Notifications
You must be signed in to change notification settings - Fork 932
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 hasOwnProperty is not a function
error
#430
Conversation
Oh and also because I have the latest npm (v5 something), it created |
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.
I'm all for calling Object#hasOwnProperty
explicitly.
But could you submit a new PR for the package-lock.json
so that the change can be reviewed and discussed separately?
@Pritilender Could you change the target branch to |
@maxtruxa Yes, I'll do it some time tonight. Sorry, haven't seen the comment. |
This reverts commit d3660f4.
@maxtruxa sorry I was quite busy that day when I've told that I'll update the branch... I updated the branch and reverted |
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.
LGTM
Will publish this fix? |
+1 on timeline for publishing. |
+1 |
Any news on this issue? |
When will this patch be published ? Still got this error on koa(v2.5.1) with oauth2-server(v3.0.0) TypeError: options.headers.hasOwnProperty is not a function |
I have no clue, but I ran into the same issue and it is related to how the headers are constructed for the underlying oauth2-server package. I wrote a derivation based on this project without koa - https://github.com/djoq/o-provide for node. For options in production, take a look at https://github.com/jazzband/django-oauth-toolkit. |
@Vergil0327 you can reference the dev branch in your package.json until someone from the maintainers publish it to npm. |
A year later... Is it still suggested to use the dev branch? I see some v4 tags and I'm scared of breaking changes. EDIT: Found my answer here (#496), sorry for the ping |
@t1bb4r As I still actively use this module in my projects, I can say that it's not pushed under current release on npm. I have v3.0.1 as my dependency for a current project (Express based, so no problems like this) and it doesn't include the code I changed in this PR. Edit: It looks like it's on v3.1.0 branch. |
@djoq Still wait for publishing |
+1 pls publish |
Writing koa adapter, I came accros an error when I pass
ctx.response
to make a newResponse
object which stated thatoptions.headers.hasOwnProperty is not a function
.I've found that I'm not alone and that there was an issue: #413 (which, btw, is closed, but don't know why).
The origin of this error could be that somewhere in koa, or wherever,
headers
are created usingObject.create(null)
.This PR changes the way of calling
hasOwnProperty
so even if an object is created withObject.create(null)
, we can still check for own properties.Also, there are two more places where
hasOwnProperty
is called as a prototype function of the object, not as direct call to prototype function, but I haven't changed them.Should I changed them also or no?