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

I got an error #1

Merged
merged 1 commit into from May 29, 2013

Conversation

Projects
None yet
3 participants
@iamdenny
Contributor

iamdenny commented May 29, 2013

Hi, I am Denny.
I'm using the node-imgur-upload module as well.
but I found an error while uploading image.
When I upload big file such as 20MB image, api.imgur.com/3/upload doesn't give us the result as JSON. It give us as HTML.
Like this,

<html>
<head><title>413 Request Entity Too Large</title></head>
<body bgcolor="white">
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx</center>
</body>
</html>
</prev>

your module do like this,
_cb(err, JSON.parse(body));
so when try to JSON.parse(body), it will be error like this,

SyntaxError: Unexpected token <
    at Object.parse (native)
    at Request._callback (/Users/nhn/Documents/workspace/lolol/trunk/image.uploader/node_modules/imgur-upload/lib/imgur-upload.js:29:19)
    at Request.self.callback (/Users/nhn/Documents/workspace/lolol/trunk/image.uploader/node_modules/imgur-upload/node_modules/request/index.js:142:22)
    at Request.EventEmitter.emit (events.js:98:17)
    at Request.<anonymous> (/Users/nhn/Documents/workspace/lolol/trunk/image.uploader/node_modules/imgur-upload/node_modules/request/index.js:856:14)
    at Request.EventEmitter.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (/Users/nhn/Documents/workspace/lolol/trunk/image.uploader/node_modules/imgur-upload/node_modules/request/index.js:808:12)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:895:16
    at process._tickCallback (node.js:415:13)

I changed the code that I'm thinking right.
please check it out and modify it.

Thank you.

adamcoulombe added a commit that referenced this pull request May 29, 2013

Merge pull request #1 from iamdenny/master
Catch non-JSON response when API is overloaded

@adamcoulombe adamcoulombe merged commit 3cc4852 into adamcoulombe:master May 29, 2013

@kimshinelove

This comment has been minimized.

Show comment
Hide comment
@kimshinelove

kimshinelove commented May 30, 2013

good~

@iamdenny

This comment has been minimized.

Show comment
Hide comment
@iamdenny

iamdenny May 31, 2013

Contributor

Can you please update the lastest code to NPM?

Contributor

iamdenny commented May 31, 2013

Can you please update the lastest code to NPM?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment