1
1
// ./superagent-mock-config.js file
2
2
module . exports = [
3
- {
4
- pattern : 'http://localhost/(\\w+)/' ,
3
+ {
4
+ pattern : 'http://localhost/(\\w+)/' ,
5
5
6
- /**
7
- * returns the data
8
- *
9
- * @param match array Result of the resolution of the regular expression
10
- * @param params object sent by 'send' function
11
- */
12
- fixtures : function ( match , params ) {
13
- return { text : "Error" , status : 403 , ok : false } ;
6
+ /**
7
+ * returns the data
8
+ *
9
+ * @param match array Result of the resolution of the regular expression
10
+ * @param params object sent by 'send' function
11
+ */
12
+ fixtures : function ( match , params ) {
13
+ return { text : "Error" , status : 403 , ok : false } ;
14
14
15
- /**
16
- * example:
17
- * request.get('https://error.example/404').end(function(err, res){
18
- * console.log(err); // 404
19
- * })
20
- */
21
- if ( match [ 1 ] === '404' ) {
22
- throw new Error ( 404 ) ;
23
- }
15
+ /**
16
+ * example:
17
+ * request.get('https://error.example/404').end(function(err, res){
18
+ * console.log(err); // 404
19
+ * })
20
+ */
21
+ if ( match [ 1 ] === '404' ) {
22
+ throw new Error ( 404 ) ;
23
+ }
24
24
25
- /**
26
- * example:
27
- * request.get('https://error.example/200').end(function(err, res){
28
- * console.log(res.body); // "Data fixtures"
29
- * })
30
- */
25
+ /**
26
+ * example:
27
+ * request.get('https://error.example/200').end(function(err, res){
28
+ * console.log(res.body); // "Data fixtures"
29
+ * })
30
+ */
31
31
32
- /**
33
- * example:
34
- * request.get('https://domain.send.example/').send({superhero: "me"}).end(function(err, res){
35
- * console.log(res.body); // "Data fixtures - superhero:me"
36
- * })
37
- */
38
- if ( params [ "superhero" ] ) {
39
- return 'Data fixtures - superhero:' + params [ "superhero" ] ;
40
- } else {
41
- return 'Data fixtures' ;
42
- }
43
- } ,
32
+ /**
33
+ * example:
34
+ * request.get('https://domain.send.example/').send({superhero: "me"}).end(function(err, res){
35
+ * console.log(res.body); // "Data fixtures - superhero:me"
36
+ * })
37
+ */
38
+ if ( params [ "superhero" ] ) {
39
+ return 'Data fixtures - superhero:' + params [ "superhero" ] ;
40
+ } else {
41
+ return 'Data fixtures' ;
42
+ }
43
+ } ,
44
44
45
- /**
46
- * returns the result of the request
47
- *
48
- * @param match array Result of the resolution of the regular expression
49
- * @param data mixed Data returns by `fixtures` attribute
50
- */
51
- callback : function ( match , data ) {
52
- return data ;
53
- }
54
- } ,
55
- ] ;
45
+ /**
46
+ * returns the result of the request
47
+ *
48
+ * @param match array Result of the resolution of the regular expression
49
+ * @param data mixed Data returns by `fixtures` attribute
50
+ */
51
+ callback : function ( match , data ) {
52
+ return data ;
53
+ }
54
+ } ,
55
+ ] ;
0 commit comments