You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected the method to return a 400 bad request or something when the argument payload (i.e.: the body of the post in the case) isn't an array of objects. However, it seems to take any valid json.
Is this expected?
The text was updated successfully, but these errors were encountered:
Yeah, I have a similar issue where when I set type to 'number', there isn't any error when passing a string like 'asdf' into the explorer. The 'asdf' then comes into the custom method as NaN, so I had to add some custom checking for that like so:
myModel.getWeather=function(latitude,longitude,cb){// rest connector doesn't check properly. Strings come in// as NaN when type accepts.type == 'number';if(isNaN(latitude)||isNaN(longitude)){varerr=newError();err.status=400;err.message="Lat and long must be numbers";returncb(err);}//Do my usual stuff knowing that these should be numbers now.cb();}
Given a remote method defined as (partial):
accepts: [{ arg: 'payload', type: ['object'], http: { source: 'body' }, required: true}] ,
I expected the method to return a
400 bad request
or something when the argumentpayload
(i.e.: the body of the post in the case) isn't an array of objects. However, it seems to take any valid json.Is this expected?
The text was updated successfully, but these errors were encountered: