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

Streaming on the current request/request #1

Open
angadn opened this issue May 14, 2016 · 2 comments
Open

Streaming on the current request/request #1

angadn opened this issue May 14, 2016 · 2 comments

Comments

@angadn
Copy link

angadn commented May 14, 2016

I seem to get this error while return request(url).

TypeError: current is not a function
<br> &nbsp; &nbsp;at next (/node_modules/request-extensible/lib/request-extensible.js:16:14)

Here is how I'm setup:

request = requestExt({
      request: require("request"),
      extensions: [
        new RequestHttpCache({
          backend: "redis",
          redisClient: redisProvider.client()
        })
      ]
    });
@suprememoocow
Copy link
Owner

Hi,

Try the following:

request = requestExt({
      request: require("request"),
      extensions: [
        new RequestHttpCache({
          backend: "redis",
          redisClient: redisProvider.client()
        }).extension
      ]
    });

(Note the .extension at the end of the RequestHttpCache constructor)

@angadn
Copy link
Author

angadn commented May 15, 2016

Definitely seems to head in the right direction: My error has now changed to this:

usr/src/my-project/node_modules/request-http-cache/lib/index.js:243
      callback(null, response, body);
      ^

TypeError: callback is not a function
    at Request._callback (/usr/src/my-project/node_modules/request-http-cache/lib/index.js:243:7)
    at Request.self.callback (/usr/src/my-project/node_modules/request/request.js:199:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (/usr/src/my-project/node_modules/request/request.js:1036:10)
    at emitOne (events.js:82:20)
    at Request.emit (events.js:169:7)
    at IncomingMessage.<anonymous> (/usr/src/my-project/node_modules/request/request.js:963:12)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)

On adding a function(err, res, body) { } style parameter, obviously request returns undefined instead of a stream.

Edit: Creating another issue for your convenience in case it is more relevant to the other repository: gitterHQ/request-http-cache#5

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

No branches or pull requests

2 participants