Another question, regarding the documentation of http - 
how come the res argument of the callback that is called on http.reuest is 
not listening to the 'end' event in the example? 
http://nodejs.org/api/http.html#http_http_request_options_callback

Also, what is the size of a chunk? is it always the same in node?
  


On Saturday, June 23, 2012 3:17:33 PM UTC-7, josh wrote:
>
> I try to POST to this url - https://browserid.org/verify. using row node 
> i get: getaddrinfo ENOENT and using the request package i get: Content-Type 
> expected to be one of: application/x-www-form-urlencoded, application/json.
>
> Another question - Is there any reason not to use browserID for 
> authentication? it seems like an easy way to avoid remembering hounders of 
> passwords. 
>
> // POST using row node
>
> var http = require('http');
>
> var options = {
>   host: 'https://browserid.org',
>   port: 80,
>   path: '/verify',
>   method: 'POST'
> };
>
> var req = http.request(options, function(res) {
>   console.log('STATUS: ' + res.statusCode);
>   console.log('HEADERS: ' + JSON.stringify(res.headers));
>   res.setEncoding('utf8');
>   res.on('data', function (chunk) {
>     console.log('BODY: ' + chunk);
>   });
> });
>
> req.on('error', function(e) {
>   console.log('problem with request: ' + e.message);
> });
>
> // write data to request body
> req.write("assertion=abc&audience=0.0.0.0");
> req.end();
>
> //---------------------------------------------------------------------
>
> // POST using the request package
>
> var http = require('http');
>
> var options = {
>   host: 'https://browserid.org',
>   port: 80,
>   path: '/verify',
>   method: 'POST'
> };
>
> var req = http.request(options, function(res) {
>   console.log('STATUS: ' + res.statusCode);
>   console.log('HEADERS: ' + JSON.stringify(res.headers));
>   res.setEncoding('utf8');
>   res.on('data', function (chunk) {
>     console.log('BODY: ' + chunk);
>   });
> });
>
> req.on('error', function(e) {
>   console.log('problem with request: ' + e.message);
> });
>
> // write data to request body
> req.write("assertion=abc&audience=0.0.0.0");
> req.end();
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to