Server Side Scripting


#1

Using server-side scripting can anybody please tell the me method I would use to interrogate any values inside ‘event.request.body’.

I’m trying to perform some logic at the step ‘user.register.post.pre_process’ the usual object notation doesn’t seem to work and it’s driving me nuts! A simple example would be:

if (event.request.body.email == 'my@email.com') {
    
    throw 'we have a match';
    
}

I’ve tried various different formats to no avail.

Many thanks


#2

There’s a bug where for user events event.request.body comes back as a string rather than an object. We should have it fixed in the next day or so. Until then you can use JSON.parse(event.request.body).email.


#3

That works, thanks Todd.

Didn’t realise it was a string, I’d foolishly assumed it was just the browser encoding the characters!


#4

event.request.body problem is fixed and will be in 1.8.1 release early next week.