Browse Source

docs

pull/4/head
Peter Johnson 10 years ago
parent
commit
ae7e88979a
  1. 23
      docs/404.md
  2. 7
      docs/cors.md
  3. 29
      docs/index.md
  4. 17
      docs/jsonp.md
  5. 11
      docs/suggest/success.md

23
docs/404.md

@ -1,6 +1,6 @@
# invalid path # invalid path
*Generated: Fri Sep 12 2014 19:16:14 GMT+0100 (BST)* *Generated: Fri Sep 12 2014 20:51:44 GMT+0100 (BST)*
## Request ## Request
```javascript ```javascript
{ {
@ -16,17 +16,18 @@
```javascript ```javascript
Status: 404 Status: 404
{ {
"x-powered-by": "pelias", "x-powered-by": "mapzen",
"charset": "utf8", "charset": "utf8",
"access-control-allow-origin": "*", "access-control-allow-origin": "*",
"access-control-allow-methods": "GET", "access-control-allow-methods": "GET",
"access-control-allow-headers": "X-Requested-With,content-type", "access-control-allow-headers": "X-Requested-With,content-type",
"access-control-allow-credentials": "true", "access-control-allow-credentials": "true",
"server": "Pelias/0.0.0",
"cache-control": "public,max-age=300", "cache-control": "public,max-age=300",
"content-type": "application/json; charset=utf-8", "content-type": "application/json; charset=utf-8",
"content-length": "35", "content-length": "35",
"etag": "W/\"23-dfdfa185\"", "etag": "W/\"23-dfdfa185\"",
"date": "Fri, 12 Sep 2014 18:16:14 GMT", "date": "Fri, 12 Sep 2014 19:51:44 GMT",
"connection": "close" "connection": "close"
} }
``` ```
@ -38,11 +39,9 @@ Status: 404
## Tests ## Tests
### ✓ should respond in json with server info ### ✓ cache-control header correctly set
```javascript ```javascript
should.exist json response.should.have.header 'Cache-Control','public,max-age=300'
should.exist json.error
json.error.should.equal 'not found: invalid path'
``` ```
### ✓ content-type header correctly set ### ✓ content-type header correctly set
@ -50,13 +49,15 @@ json.error.should.equal 'not found: invalid path'
response.should.have.header 'Content-Type','application/json; charset=utf-8' response.should.have.header 'Content-Type','application/json; charset=utf-8'
``` ```
### ✓ cache-control header correctly set ### ✓ not found
```javascript ```javascript
response.should.have.header 'Cache-Control','public,max-age=300' response.statusCode.should.equal 404
``` ```
### ✓ not found ### ✓ should respond in json with server info
```javascript ```javascript
response.statusCode.should.equal 404 should.exist json
should.exist json.error
json.error.should.equal 'not found: invalid path'
``` ```

7
docs/cors.md

@ -1,6 +1,6 @@
# cross-origin resource sharing # cross-origin resource sharing
*Generated: Fri Sep 12 2014 19:16:14 GMT+0100 (BST)* *Generated: Fri Sep 12 2014 20:51:44 GMT+0100 (BST)*
## Request ## Request
```javascript ```javascript
{ {
@ -16,17 +16,18 @@
```javascript ```javascript
Status: 200 Status: 200
{ {
"x-powered-by": "pelias", "x-powered-by": "mapzen",
"charset": "utf8", "charset": "utf8",
"access-control-allow-origin": "*", "access-control-allow-origin": "*",
"access-control-allow-methods": "GET", "access-control-allow-methods": "GET",
"access-control-allow-headers": "X-Requested-With,content-type", "access-control-allow-headers": "X-Requested-With,content-type",
"access-control-allow-credentials": "true", "access-control-allow-credentials": "true",
"server": "Pelias/0.0.0",
"cache-control": "public,max-age=60", "cache-control": "public,max-age=60",
"content-type": "application/json; charset=utf-8", "content-type": "application/json; charset=utf-8",
"content-length": "50", "content-length": "50",
"etag": "W/\"32-85536434\"", "etag": "W/\"32-85536434\"",
"date": "Fri, 12 Sep 2014 18:16:14 GMT", "date": "Fri, 12 Sep 2014 19:51:44 GMT",
"connection": "close" "connection": "close"
} }
``` ```

29
docs/index.md

@ -1,6 +1,6 @@
# api root # api root
*Generated: Fri Sep 12 2014 19:16:14 GMT+0100 (BST)* *Generated: Fri Sep 12 2014 20:51:45 GMT+0100 (BST)*
## Request ## Request
```javascript ```javascript
{ {
@ -16,17 +16,18 @@
```javascript ```javascript
Status: 200 Status: 200
{ {
"x-powered-by": "pelias", "x-powered-by": "mapzen",
"charset": "utf8", "charset": "utf8",
"access-control-allow-origin": "*", "access-control-allow-origin": "*",
"access-control-allow-methods": "GET", "access-control-allow-methods": "GET",
"access-control-allow-headers": "X-Requested-With,content-type", "access-control-allow-headers": "X-Requested-With,content-type",
"access-control-allow-credentials": "true", "access-control-allow-credentials": "true",
"server": "Pelias/0.0.0",
"cache-control": "public,max-age=60", "cache-control": "public,max-age=60",
"content-type": "application/json; charset=utf-8", "content-type": "application/json; charset=utf-8",
"content-length": "50", "content-length": "50",
"etag": "W/\"32-85536434\"", "etag": "W/\"32-85536434\"",
"date": "Fri, 12 Sep 2014 18:16:14 GMT", "date": "Fri, 12 Sep 2014 19:51:44 GMT",
"connection": "close" "connection": "close"
} }
``` ```
@ -41,9 +42,14 @@ Status: 200
## Tests ## Tests
### ✓ vanity header correctly set ### ✓ content-type header correctly set
```javascript ```javascript
response.should.have.header 'X-Powered-By','pelias' response.should.have.header 'Content-Type','application/json; charset=utf-8'
```
### ✓ endpoint available
```javascript
response.statusCode.should.equal 200
``` ```
### ✓ cache-control header correctly set ### ✓ cache-control header correctly set
@ -51,19 +57,20 @@ response.should.have.header 'X-Powered-By','pelias'
response.should.have.header 'Cache-Control','public,max-age=60' response.should.have.header 'Cache-Control','public,max-age=60'
``` ```
### ✓ endpoint available ### ✓ charset header correctly set
```javascript ```javascript
response.statusCode.should.equal 200 response.should.have.header 'Charset','utf8'
``` ```
### ✓ content-type header correctly set ### ✓ server header correctly set
```javascript ```javascript
response.should.have.header 'Content-Type','application/json; charset=utf-8' response.should.have.header 'Server'
response.headers.server.should.match /Pelias\/\d{1,2}\.\d{1,2}\.\d{1,2}/
``` ```
### ✓ charset header correctly set ### ✓ vanity header correctly set
```javascript ```javascript
response.should.have.header 'Charset','utf8' response.should.have.header 'X-Powered-By','mapzen'
``` ```
### ✓ should respond in json with server info ### ✓ should respond in json with server info

17
docs/jsonp.md

@ -1,6 +1,6 @@
# jsonp # jsonp
*Generated: Fri Sep 12 2014 19:16:14 GMT+0100 (BST)* *Generated: Fri Sep 12 2014 20:51:45 GMT+0100 (BST)*
## Request ## Request
```javascript ```javascript
{ {
@ -16,17 +16,18 @@
```javascript ```javascript
Status: 200 Status: 200
{ {
"x-powered-by": "pelias", "x-powered-by": "mapzen",
"charset": "utf8", "charset": "utf8",
"access-control-allow-origin": "*", "access-control-allow-origin": "*",
"access-control-allow-methods": "GET", "access-control-allow-methods": "GET",
"access-control-allow-headers": "X-Requested-With,content-type", "access-control-allow-headers": "X-Requested-With,content-type",
"access-control-allow-credentials": "true", "access-control-allow-credentials": "true",
"server": "Pelias/0.0.0",
"cache-control": "public,max-age=60", "cache-control": "public,max-age=60",
"content-type": "application/javascript; charset=utf-8", "content-type": "application/javascript; charset=utf-8",
"content-length": "57", "content-length": "57",
"etag": "W/\"39-b8a2aba1\"", "etag": "W/\"39-b8a2aba1\"",
"date": "Fri, 12 Sep 2014 18:16:14 GMT", "date": "Fri, 12 Sep 2014 19:51:44 GMT",
"connection": "close" "connection": "close"
} }
``` ```
@ -36,14 +37,14 @@ test({"name":"pelias-api","version":{"number":"0.0.0"}});
## Tests ## Tests
### ✓ content-type header correctly set
```javascript
response.should.have.header 'Content-Type','application/javascript; charset=utf-8'
```
### ✓ should respond with jsonp ### ✓ should respond with jsonp
```javascript ```javascript
should.exist response.body should.exist response.body
response.body.substr(0,5).should.equal 'test('; response.body.substr(0,5).should.equal 'test(';
``` ```
### ✓ content-type header correctly set
```javascript
response.should.have.header 'Content-Type','application/javascript; charset=utf-8'
```

11
docs/suggest/success.md

@ -1,6 +1,6 @@
# valid suggest query # valid suggest query
*Generated: Fri Sep 12 2014 19:16:14 GMT+0100 (BST)* *Generated: Fri Sep 12 2014 20:51:45 GMT+0100 (BST)*
## Request ## Request
```javascript ```javascript
{ {
@ -16,23 +16,24 @@
```javascript ```javascript
Status: 200 Status: 200
{ {
"x-powered-by": "pelias", "x-powered-by": "mapzen",
"charset": "utf8", "charset": "utf8",
"access-control-allow-origin": "*", "access-control-allow-origin": "*",
"access-control-allow-methods": "GET", "access-control-allow-methods": "GET",
"access-control-allow-headers": "X-Requested-With,content-type", "access-control-allow-headers": "X-Requested-With,content-type",
"access-control-allow-credentials": "true", "access-control-allow-credentials": "true",
"server": "Pelias/0.0.0",
"cache-control": "public,max-age=60", "cache-control": "public,max-age=60",
"content-type": "application/json; charset=utf-8", "content-type": "application/json; charset=utf-8",
"content-length": "1248", "content-length": "1248",
"etag": "W/\"htT1UWW77Ibdm7ncnD9KgA==\"", "etag": "W/\"o9NALcf9i0O3JoLO7pfqog==\"",
"date": "Fri, 12 Sep 2014 18:16:14 GMT", "date": "Fri, 12 Sep 2014 19:51:44 GMT",
"connection": "close" "connection": "close"
} }
``` ```
```javascript ```javascript
{ {
"date": 1410545774257, "date": 1410551504928,
"body": [ "body": [
{ {
"text": "ACRELÂNDIA, Brazil", "text": "ACRELÂNDIA, Brazil",

Loading…
Cancel
Save