From ae7e88979af9a8ec668568b05c240a8f06ed697a Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Fri, 12 Sep 2014 20:51:51 +0100 Subject: [PATCH] docs --- docs/404.md | 23 ++++++++++++----------- docs/cors.md | 7 ++++--- docs/index.md | 29 ++++++++++++++++++----------- docs/jsonp.md | 17 +++++++++-------- docs/suggest/success.md | 11 ++++++----- 5 files changed, 49 insertions(+), 38 deletions(-) diff --git a/docs/404.md b/docs/404.md index 3760d337..e683e480 100644 --- a/docs/404.md +++ b/docs/404.md @@ -1,6 +1,6 @@ # 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 ```javascript { @@ -16,17 +16,18 @@ ```javascript Status: 404 { - "x-powered-by": "pelias", + "x-powered-by": "mapzen", "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", + "server": "Pelias/0.0.0", "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:16:14 GMT", + "date": "Fri, 12 Sep 2014 19:51:44 GMT", "connection": "close" } ``` @@ -38,11 +39,9 @@ Status: 404 ## Tests -### ✓ should respond in json with server info +### ✓ cache-control header correctly set ```javascript -should.exist json -should.exist json.error -json.error.should.equal 'not found: invalid path' +response.should.have.header 'Cache-Control','public,max-age=300' ``` ### ✓ 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' ``` -### ✓ cache-control header correctly set +### ✓ not found ```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 -response.statusCode.should.equal 404 +should.exist json +should.exist json.error +json.error.should.equal 'not found: invalid path' ``` diff --git a/docs/cors.md b/docs/cors.md index 14f1a4ae..0df8dc00 100644 --- a/docs/cors.md +++ b/docs/cors.md @@ -1,6 +1,6 @@ # 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 ```javascript { @@ -16,17 +16,18 @@ ```javascript Status: 200 { - "x-powered-by": "pelias", + "x-powered-by": "mapzen", "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", + "server": "Pelias/0.0.0", "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:16:14 GMT", + "date": "Fri, 12 Sep 2014 19:51:44 GMT", "connection": "close" } ``` diff --git a/docs/index.md b/docs/index.md index 3ea5e22b..963ab240 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,6 +1,6 @@ # 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 ```javascript { @@ -16,17 +16,18 @@ ```javascript Status: 200 { - "x-powered-by": "pelias", + "x-powered-by": "mapzen", "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", + "server": "Pelias/0.0.0", "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:16:14 GMT", + "date": "Fri, 12 Sep 2014 19:51:44 GMT", "connection": "close" } ``` @@ -41,9 +42,14 @@ Status: 200 ## Tests -### ✓ vanity header correctly set +### ✓ content-type header correctly set ```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 @@ -51,19 +57,20 @@ response.should.have.header 'X-Powered-By','pelias' response.should.have.header 'Cache-Control','public,max-age=60' ``` -### ✓ endpoint available +### ✓ charset header correctly set ```javascript -response.statusCode.should.equal 200 +response.should.have.header 'Charset','utf8' ``` -### ✓ content-type header correctly set +### ✓ server header correctly set ```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 -response.should.have.header 'Charset','utf8' +response.should.have.header 'X-Powered-By','mapzen' ``` ### ✓ should respond in json with server info diff --git a/docs/jsonp.md b/docs/jsonp.md index a6fe0ead..a67e5c40 100644 --- a/docs/jsonp.md +++ b/docs/jsonp.md @@ -1,6 +1,6 @@ # jsonp -*Generated: Fri Sep 12 2014 19:16:14 GMT+0100 (BST)* +*Generated: Fri Sep 12 2014 20:51:45 GMT+0100 (BST)* ## Request ```javascript { @@ -16,17 +16,18 @@ ```javascript Status: 200 { - "x-powered-by": "pelias", + "x-powered-by": "mapzen", "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", + "server": "Pelias/0.0.0", "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:16:14 GMT", + "date": "Fri, 12 Sep 2014 19:51:44 GMT", "connection": "close" } ``` @@ -36,14 +37,14 @@ 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('; ``` +### ✓ content-type header correctly set +```javascript +response.should.have.header 'Content-Type','application/javascript; charset=utf-8' +``` + diff --git a/docs/suggest/success.md b/docs/suggest/success.md index 762e52e4..abcc5db4 100644 --- a/docs/suggest/success.md +++ b/docs/suggest/success.md @@ -1,6 +1,6 @@ # 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 ```javascript { @@ -16,23 +16,24 @@ ```javascript Status: 200 { - "x-powered-by": "pelias", + "x-powered-by": "mapzen", "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", + "server": "Pelias/0.0.0", "cache-control": "public,max-age=60", "content-type": "application/json; charset=utf-8", "content-length": "1248", - "etag": "W/\"htT1UWW77Ibdm7ncnD9KgA==\"", - "date": "Fri, 12 Sep 2014 18:16:14 GMT", + "etag": "W/\"o9NALcf9i0O3JoLO7pfqog==\"", + "date": "Fri, 12 Sep 2014 19:51:44 GMT", "connection": "close" } ``` ```javascript { - "date": 1410545774257, + "date": 1410551504928, "body": [ { "text": "ACRELÂNDIA, Brazil",