Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion req.body undefined in POST request
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
vision media [ Tj Holowaychuk ]  
View profile  
 More options Oct 30 2010, 9:47 pm
From: "vision media [ Tj Holowaychuk ]" <t...@vision-media.ca>
Date: Sat, 30 Oct 2010 18:47:06 -0700
Local: Sat, Oct 30 2010 9:47 pm
Subject: Re: [Express-js] req.body undefined in POST request

few pointers:

   1.  you are not required to use app.configure() if you dont plan on (or
   need) different environments
   2. you need to set the Content-Type to either application/json or
   application/x-www-form-urlencoded, these are the two that bodyDecoder parses

On Sat, Oct 30, 2010 at 3:27 PM, soeren <soeren.roer...@googlemail.com>wrote:

> Hi everyone,

> I seem to have a problem with req.body being "undefined" when using a
> POST request. Im using expresso to do the POST:

> -- snip
> assert.response(server, {
>    url: '/',
>    method: 'POST',
>    data: '{"somevar": "somestring"}'
>  }, {
>     body: 'someresponse'
> });
> -- /snip

> express = require('express').
> server = express.createServer();

> server.configure(function() { server.use(express.bodyDecoder()); };

> server.post('/', function(req, res) {
>        console.log(req.body);
> });

> I'm using version 1.0.0rc4.
> Any pointers would be greatly appreciated.

> --
> You received this message because you are subscribed to the Google Groups
> "Express" group.
> To post to this group, send email to express-js@googlegroups.com.
> To unsubscribe from this group, send email to
> express-js+unsubscribe@googlegroups.com<express-js%2Bunsubscribe@googlegrou ps.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/express-js?hl=en.

--
Tj Holowaychuk
Vision Media
President & Creative Lead

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.