-
Notifications
You must be signed in to change notification settings - Fork 28
/
query-string.js
50 lines (46 loc) · 1.08 KB
/
query-string.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const koala = require('..');
const request = require('supertest');
describe('Nested Query Strings', () => {
describe('when options.qs = false', () => {
test('should not support nested query strings', () => {
const app = koala();
app.use(function * (next) {
this.response.body = this.request.query;
});
return request(app.callback())
.get('/')
.query({
something: {
nested: true
}
})
.expect(200)
.expect({
'something[nested]': 'true'
});
});
});
describe('when options.qs = true', () => {
test('should support nested query strings', () => {
const app = koala({
qs: true
});
app.use(function * (next) {
this.response.body = this.request.query;
});
return request(app.callback())
.get('/')
.query({
something: {
nested: true
}
})
.expect(200)
.expect({
something: {
nested: 'true'
}
});
});
});
});