mirror of https://github.com/pelias/api.git
Peter Johnson
10 years ago
5 changed files with 390 additions and 0 deletions
@ -0,0 +1,65 @@
|
||||
# invalid path |
||||
|
||||
*Generated: Fri Sep 12 2014 19:14:09 GMT+0100 (BST)* |
||||
## Request |
||||
```javascript |
||||
{ |
||||
"protocol": "http:", |
||||
"host": "localhost", |
||||
"method": "GET", |
||||
"port": 3100, |
||||
"path": "/notexist", |
||||
"headers": { |
||||
"User-Agent": "Ciao/Client 1.0" |
||||
} |
||||
} |
||||
``` |
||||
|
||||
## Response |
||||
```javascript |
||||
Status: 404 |
||||
{ |
||||
"x-powered-by": "pelias", |
||||
"charset": "utf8", |
||||
"access-control-allow-origin": "*", |
||||
"access-control-allow-methods": "GET", |
||||
"access-control-allow-headers": "X-Requested-With,content-type", |
||||
"access-control-allow-credentials": "true", |
||||
"cache-control": "public,max-age=300", |
||||
"content-type": "application/json; charset=utf-8", |
||||
"content-length": "35", |
||||
"etag": "W/\"23-dfdfa185\"", |
||||
"date": "Fri, 12 Sep 2014 18:14:09 GMT", |
||||
"connection": "close" |
||||
} |
||||
``` |
||||
```javascript |
||||
{ |
||||
"error": "not found: invalid path" |
||||
} |
||||
``` |
||||
|
||||
## Tests |
||||
|
||||
### ✓ content-type header correctly set |
||||
```javascript |
||||
response.should.have.header 'Content-Type','application/json; charset=utf-8' |
||||
``` |
||||
|
||||
### ✓ should respond in json with server info |
||||
```javascript |
||||
should.exist json |
||||
should.exist json.error |
||||
json.error.should.equal 'not found: invalid path' |
||||
``` |
||||
|
||||
### ✓ cache-control header correctly set |
||||
```javascript |
||||
response.should.have.header 'Cache-Control','public,max-age=300' |
||||
``` |
||||
|
||||
### ✓ not found |
||||
```javascript |
||||
response.statusCode.should.equal 404 |
||||
``` |
||||
|
@ -0,0 +1,54 @@
|
||||
# cross-origin resource sharing |
||||
|
||||
*Generated: Fri Sep 12 2014 19:14:09 GMT+0100 (BST)* |
||||
## Request |
||||
```javascript |
||||
{ |
||||
"protocol": "http:", |
||||
"host": "localhost", |
||||
"method": "GET", |
||||
"port": 3100, |
||||
"path": "/", |
||||
"headers": { |
||||
"User-Agent": "Ciao/Client 1.0" |
||||
} |
||||
} |
||||
``` |
||||
|
||||
## Response |
||||
```javascript |
||||
Status: 200 |
||||
{ |
||||
"x-powered-by": "pelias", |
||||
"charset": "utf8", |
||||
"access-control-allow-origin": "*", |
||||
"access-control-allow-methods": "GET", |
||||
"access-control-allow-headers": "X-Requested-With,content-type", |
||||
"access-control-allow-credentials": "true", |
||||
"cache-control": "public,max-age=60", |
||||
"content-type": "application/json; charset=utf-8", |
||||
"content-length": "50", |
||||
"etag": "W/\"32-85536434\"", |
||||
"date": "Fri, 12 Sep 2014 18:14:09 GMT", |
||||
"connection": "close" |
||||
} |
||||
``` |
||||
```javascript |
||||
{ |
||||
"name": "pelias-api", |
||||
"version": { |
||||
"number": "0.0.0" |
||||
} |
||||
} |
||||
``` |
||||
|
||||
## Tests |
||||
|
||||
### ✓ access control headers correctly set |
||||
```javascript |
||||
response.should.have.header 'Access-Control-Allow-Origin','*' |
||||
response.should.have.header 'Access-Control-Allow-Methods','GET' |
||||
response.should.have.header 'Access-Control-Allow-Headers','X-Requested-With,content-type' |
||||
response.should.have.header 'Access-Control-Allow-Credentials','true' |
||||
``` |
||||
|
@ -0,0 +1,78 @@
|
||||
# api root |
||||
|
||||
*Generated: Fri Sep 12 2014 19:14:09 GMT+0100 (BST)* |
||||
## Request |
||||
```javascript |
||||
{ |
||||
"protocol": "http:", |
||||
"host": "localhost", |
||||
"method": "GET", |
||||
"port": 3100, |
||||
"path": "/", |
||||
"headers": { |
||||
"User-Agent": "Ciao/Client 1.0" |
||||
} |
||||
} |
||||
``` |
||||
|
||||
## Response |
||||
```javascript |
||||
Status: 200 |
||||
{ |
||||
"x-powered-by": "pelias", |
||||
"charset": "utf8", |
||||
"access-control-allow-origin": "*", |
||||
"access-control-allow-methods": "GET", |
||||
"access-control-allow-headers": "X-Requested-With,content-type", |
||||
"access-control-allow-credentials": "true", |
||||
"cache-control": "public,max-age=60", |
||||
"content-type": "application/json; charset=utf-8", |
||||
"content-length": "50", |
||||
"etag": "W/\"32-85536434\"", |
||||
"date": "Fri, 12 Sep 2014 18:14:09 GMT", |
||||
"connection": "close" |
||||
} |
||||
``` |
||||
```javascript |
||||
{ |
||||
"name": "pelias-api", |
||||
"version": { |
||||
"number": "0.0.0" |
||||
} |
||||
} |
||||
``` |
||||
|
||||
## Tests |
||||
|
||||
### ✓ endpoint available |
||||
```javascript |
||||
response.statusCode.should.equal 200 |
||||
``` |
||||
|
||||
### ✓ vanity header correctly set |
||||
```javascript |
||||
response.should.have.header 'X-Powered-By','pelias' |
||||
``` |
||||
|
||||
### ✓ cache-control header correctly set |
||||
```javascript |
||||
response.should.have.header 'Cache-Control','public,max-age=60' |
||||
``` |
||||
|
||||
### ✓ should respond in json with server info |
||||
```javascript |
||||
should.exist json |
||||
should.exist json.name |
||||
should.exist json.version |
||||
``` |
||||
|
||||
### ✓ content-type header correctly set |
||||
```javascript |
||||
response.should.have.header 'Content-Type','application/json; charset=utf-8' |
||||
``` |
||||
|
||||
### ✓ charset header correctly set |
||||
```javascript |
||||
response.should.have.header 'Charset','utf8' |
||||
``` |
||||
|
@ -0,0 +1,52 @@
|
||||
# jsonp |
||||
|
||||
*Generated: Fri Sep 12 2014 19:14:09 GMT+0100 (BST)* |
||||
## Request |
||||
```javascript |
||||
{ |
||||
"protocol": "http:", |
||||
"host": "localhost", |
||||
"method": "GET", |
||||
"port": 3100, |
||||
"path": "/?callback=test", |
||||
"headers": { |
||||
"User-Agent": "Ciao/Client 1.0" |
||||
} |
||||
} |
||||
``` |
||||
|
||||
## Response |
||||
```javascript |
||||
Status: 200 |
||||
{ |
||||
"x-powered-by": "pelias", |
||||
"charset": "utf8", |
||||
"access-control-allow-origin": "*", |
||||
"access-control-allow-methods": "GET", |
||||
"access-control-allow-headers": "X-Requested-With,content-type", |
||||
"access-control-allow-credentials": "true", |
||||
"cache-control": "public,max-age=60", |
||||
"content-type": "application/javascript; charset=utf-8", |
||||
"content-length": "57", |
||||
"etag": "W/\"39-b8a2aba1\"", |
||||
"date": "Fri, 12 Sep 2014 18:14:09 GMT", |
||||
"connection": "close" |
||||
} |
||||
``` |
||||
```html |
||||
test({"name":"pelias-api","version":{"number":"0.0.0"}}); |
||||
``` |
||||
|
||||
## Tests |
||||
|
||||
### ✓ content-type header correctly set |
||||
```javascript |
||||
response.should.have.header 'Content-Type','application/javascript; charset=utf-8' |
||||
``` |
||||
|
||||
### ✓ should respond with jsonp |
||||
```javascript |
||||
should.exist response.body |
||||
response.body.substr(0,5).should.equal 'test('; |
||||
``` |
||||
|
Loading…
Reference in new issue