Skip to content
This repository has been archived by the owner on Jun 6, 2022. It is now read-only.

req.body.long_url is undefined #10

Open
peterpme opened this issue Dec 16, 2016 · 1 comment
Open

req.body.long_url is undefined #10

peterpme opened this issue Dec 16, 2016 · 1 comment

Comments

@peterpme
Copy link

Hey,

Thanks for creating this! Awesome library!

I'm running into an issue req.body.long_url being undefined no matter if I try raw json, form-data or any other option I have for a parameter.

Do you have any advice?

Thanks!

@mandadimuralidharreddy
Copy link

Which tool your using to make post request?
Below are sample codes
For cUrl request

curl -X POST \
  http://localhost:3000/api/v1/shorten \
  -H 'content-type: application/x-www-form-urlencoded' \
  -d long_url=https%3A%2F%2Fgoogle.com%2F

for jQuery ajax

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://localhost:3000/api/v1/shorten",
  "method": "POST",
  "headers": {
    "content-type": "application/x-www-form-urlencoded",
  },
  "data": {
    "long_url": "https://google.com/"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants