You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
1.6 KiB

10 years ago
# api root
10 years ago
*Generated: Thu Sep 18 2014 14:53:39 GMT+0100 (BST)*
10 years ago
## Request
```javascript
{
"protocol": "http:",
"host": "localhost",
"method": "GET",
"port": 3100,
10 years ago
"path": "/"
10 years ago
}
```
## Response
```javascript
Status: 200
{
10 years ago
"x-powered-by": "mapzen",
10 years ago
"charset": "utf8",
10 years ago
"cache-control": "public,max-age=60",
"server": "Pelias/0.0.0",
10 years ago
"access-control-allow-origin": "*",
"access-control-allow-methods": "GET",
"access-control-allow-headers": "X-Requested-With,content-type",
"access-control-allow-credentials": "true",
"content-type": "application/json; charset=utf-8",
"content-length": "50",
"etag": "W/\"32-85536434\"",
10 years ago
"date": "Thu, 18 Sep 2014 13:53:39 GMT",
10 years ago
"connection": "close"
}
```
```javascript
{
"name": "pelias-api",
"version": {
"number": "0.0.0"
}
}
```
## Tests
10 years ago
### ✓ server header correctly set
```javascript
response.should.have.header 'Server'
response.headers.server.should.match /Pelias\/\d{1,2}\.\d{1,2}\.\d{1,2}/
```
10 years ago
### ✓ content-type header correctly set
10 years ago
```javascript
10 years ago
response.should.have.header 'Content-Type','application/json; charset=utf-8'
```
### ✓ endpoint available
```javascript
response.statusCode.should.equal 200
10 years ago
```
### ✓ cache-control header correctly set
```javascript
response.should.have.header 'Cache-Control','public,max-age=60'
```
10 years ago
### ✓ vanity header correctly set
10 years ago
```javascript
10 years ago
response.should.have.header 'X-Powered-By','mapzen'
10 years ago
```
10 years ago
### ✓ charset header correctly set
10 years ago
```javascript
10 years ago
response.should.have.header 'Charset','utf8'
10 years ago
```
10 years ago
### ✓ should respond in json with server info
```javascript
should.exist json
should.exist json.name
should.exist json.version
```