-
Notifications
You must be signed in to change notification settings - Fork 73
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
Normalize CookieJar requests internally, document normalizeRequest #109
Comments
Yep, this isn't documented, sorry. You can use the http-apps Chain to create a request function that stores cookies: var HTTP = require("q-io/http");
var HttpApps = require("q-io/http-apps");
var cookieRequest = HttpApps.Chain()
.use(function (app) { return function (request) { return app(HTTP.normalizeRequest(request)); }; })
.use(HttpApps.CookieJar)
// you can add other middleware here too
.end(HTTP.request);
cookieRequest("http://www.google.com")
.done(function (response) {
console.log(response);
}); |
This is more complicated than I thought. Can you make API simpler? |
The need for If you don't think you will need the chain then you can just do: var cookieRequest = HttpApps.CookieJar(HTTP.request);
cookieRequest(HTTP.normalizeRequest("http://www.google.com")).then( ... ); |
Let’s treat the need for normalizeRequest as a bug with two sides.
var HTTP = require("q-io/http");
var HttpApps = require("q-io/http-apps");
var cookieRequest = HttpApps.Chain()
.use(HttpApps.Normalize)
.use(HttpApps.CookieJar)
.end(HTTP.request);
cookieRequest("http://www.google.com")
.done(function (response) {
console.log(response);
}); On Mon, Jul 14, 2014 at 3:49 PM, Stuart Knightley [email protected]
|
👍 |
request supports it, but there is no documentation about cookies in q-io.
The text was updated successfully, but these errors were encountered: