silkapp / rest

Packages for defining APIs, running them, generating client code and documentation.
http://silkapp.github.io/rest
390 stars 52 forks source link

rest-gen/JavaScript: Automatically initialize cookie jar for node.js users #60

Closed mb21 closed 9 years ago

mb21 commented 10 years ago

Update base.js to produce something like in this latest commit.

This doesn't force the consumer of the silk module (like example.js) to require request if he wants to run with the default config.

bergmark commented 10 years ago

To clarify this, currently when using the generated JS client on node.js you need to initialize a cookie jar manually like this if you want cookie handling:

Api.defaultAjaxOptions.jar = require("request").jar();

This should be done inside base.js instead, and not globally. Each Api instance should get its own cookie jar.

bergmark commented 9 years ago

This has been fixed!