isomorphic-fetch icon indicating copy to clipboard operation
isomorphic-fetch copied to clipboard

req.body has set body as property

Open renehauck opened this issue 7 years ago • 1 comments

Hi,

i send a post with

fetch(url, {
            method: 'POST',
            mode: 'no-cors',
            redirect: 'follow',
            body: JSON.stringify({ hello:"world" }),
            headers: new Headers({
                'Content-Type': 'application/x-www-form-urlencoded',
                Accept: 'application/json',
            })
        })

to my (express) server:

 this.express.post(Routes.Login, (req, res, next) => {
            let request = req.body;
            console.log(request)
            res.sendStatus(200);

and console.log show this result

{ '{"hello":"world"}': '' }

the stringified object { hello:"world" } is a property of req.body.

Is this a bug, or what I am doing wrong?

Thx

renehauck avatar Mar 20 '17 15:03 renehauck

It's been a while since I used express but what you've described doesn't seem unexpected to me. What did you expect to happen in this case?

matthew-andrews avatar Apr 26 '17 04:04 matthew-andrews