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.

51 lines
1.1 KiB

10 years ago
# jsonp
10 years ago
*Generated: Fri Sep 19 2014 14:38:01 GMT+0100 (BST)*
10 years ago
## Request
```javascript
{
"protocol": "http:",
"host": "localhost",
"method": "GET",
"port": 3100,
10 years ago
"path": "/?callback=test"
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/javascript; charset=utf-8",
"content-length": "57",
"etag": "W/\"39-b8a2aba1\"",
10 years ago
"date": "Fri, 19 Sep 2014 13:38:01 GMT",
10 years ago
"connection": "close"
}
```
```html
test({"name":"pelias-api","version":{"number":"0.0.0"}});
```
## Tests
### ✓ should respond with jsonp
```javascript
should.exist response.body
response.body.substr(0,5).should.equal 'test(';
```
10 years ago
### ✓ content-type header correctly set
```javascript
response.should.have.header 'Content-Type','application/javascript; charset=utf-8'
```