@@ -10,35 +10,36 @@ var router = new PromiseRouter();
10
10
11
11
// Returns a promise that resolves to a {response} object.
12
12
function handleFind ( req ) {
13
+ var body = req . method === 'GET' ? req . query : req . body ;
13
14
var options = { } ;
14
- if ( req . body . skip ) {
15
- options . skip = Number ( req . body . skip ) ;
15
+ if ( body . skip ) {
16
+ options . skip = Number ( body . skip ) ;
16
17
}
17
- if ( req . body . limit ) {
18
- options . limit = Number ( req . body . limit ) ;
18
+ if ( body . limit ) {
19
+ options . limit = Number ( body . limit ) ;
19
20
}
20
- if ( req . body . order ) {
21
- options . order = String ( req . body . order ) ;
21
+ if ( body . order ) {
22
+ options . order = String ( body . order ) ;
22
23
}
23
- if ( req . body . count ) {
24
+ if ( body . count ) {
24
25
options . count = true ;
25
26
}
26
- if ( typeof req . body . keys == 'string' ) {
27
- options . keys = req . body . keys ;
27
+ if ( typeof body . keys == 'string' ) {
28
+ options . keys = body . keys ;
28
29
}
29
- if ( req . body . include ) {
30
- options . include = String ( req . body . include ) ;
30
+ if ( body . include ) {
31
+ options . include = String ( body . include ) ;
31
32
}
32
- if ( req . body . redirectClassNameForKey ) {
33
- options . redirectClassNameForKey = String ( req . body . redirectClassNameForKey ) ;
33
+ if ( body . redirectClassNameForKey ) {
34
+ options . redirectClassNameForKey = String ( body . redirectClassNameForKey ) ;
34
35
}
35
36
36
- if ( typeof req . body . where === 'string' ) {
37
- req . body . where = JSON . parse ( req . body . where ) ;
37
+ if ( typeof body . where === 'string' ) {
38
+ body . where = JSON . parse ( body . where ) ;
38
39
}
39
40
40
41
return rest . find ( req . config , req . auth ,
41
- req . params . className , req . body . where , options )
42
+ req . params . className , body . where , options )
42
43
. then ( ( response ) => {
43
44
return { response : response } ;
44
45
} ) ;
0 commit comments