This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = require('supertest') | |
const app = require('../../server/server') | |
const faker = require('faker') | |
const expect = require('chai').expect | |
function req (verb, url) { | |
return request(app)[verb](url) | |
.set('Content-Type', 'application/json') | |
.set('Accept', 'application/json') | |
.expect('Content-Type', /json/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET /firmware/:application/versions | |
HEADERS: | |
id: id | |
token: token | |
host: esp | |
version: current version | |
image: image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
application: application, | |
last: { | |
version: 0.1.100, | |
created: timestamp, | |
host: cdn-host, | |
url: url | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -I https://dl.dropboxusercontent.com/s/jwnjhet4tngh3nh/user1.bin\?dl\=0 | |
HTTP/1.1 200 OK | |
accept-ranges: bytes | |
cache-control: max-age=0 | |
content-disposition: inline; filename="user1.bin"; filename*=UTF-8''user1.bin | |
Content-Length: 387808 | |
Content-Type: application/octet-stream | |
Date: Thu, 14 May 2015 07:07:36 GMT | |
etag: 1n | |
pragma: public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"url": "https://dl.dropboxusercontent.com/s/jwnjhet4tngh3nh/user1.bin?dl=0", | |
"expires": "Tue, 01 Jan 2030 00:00:00 GMT", | |
"direct": true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -I https://db.tt/agqgwH1T | |
HTTP/1.1 302 FOUND | |
Server: nginx | |
Date: Thu, 14 May 2015 06:52:09 GMT | |
Content-Type: text/html; charset=utf-8 | |
Connection: keep-alive | |
location: https://www.dropbox.com/s/jwnjhet4tngh3nh/user1.bin?dl=0 | |
pragma: no-cache | |
cache-control: no-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"url": "https://db.tt/agqgwH1T", | |
"expires": "Tue, 01 Jan 2030 00:00:00 GMT", | |
"direct": false | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Dropbox = require("dropbox"); | |
// Browser-side applications do not use the API secret. | |
var client = new Dropbox.Client({ | |
token: "your-token" | |
}); | |
client.authenticate(function(error, client) { | |
if (error) { | |
return console.log(error); |