node-restify-validation icon indicating copy to clipboard operation
node-restify-validation copied to clipboard

Can't see variables submitted via application/x-www-form-urlencoded

Open SilentImp opened this issue 7 years ago • 3 comments

I am keep getting 409 Conflict

{
"code": "InvalidArgument",
"message": "name (MISSING): Field is required, email (INVALID): Invalid email"
}

if I am sending data with

Content-Type: application/x-www-form-urlencoded


name=Anton&email=boogagoogle.co
import restify from 'restify';
import restifyValidation from 'node-restify-validation';
const server = restify.createServer();
server.use(restify.plugins.queryParser());
server.use(restify.plugins.bodyParser());
server.use(restifyValidation.validationPlugin());
server.post({
  url: '/',
  validation: {
    queries: {
      name: {
        isRequired: true,
      },
      email: {
        isEmail: true
      },
    },
  }}, async (req, res, next)=>{});

I have tried content instead of queries also. What gone wrong?

SilentImp avatar Aug 17 '17 07:08 SilentImp

What is your restify version ?

gchauvet avatar Aug 18 '17 09:08 gchauvet

Was there ever resolution or a workaround for this issue?

knudsenjeremy avatar Feb 27 '18 23:02 knudsenjeremy

Hi,

Email is invalid. Try with [email protected] seems to be ok. Take a look in unit tests in this project.

gchauvet avatar Feb 28 '18 15:02 gchauvet