diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2017-02-06 16:27:51 +0100 |
---|---|---|
committer | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2017-02-07 12:17:40 +0100 |
commit | 318690645eb57e5c0092574e54a660991383dbec (patch) | |
tree | f57b93d5cfd265b9c8b47c9819ebc83d9774ac12 /test/storage | |
parent | e6659242bc4b2b19f74cfa44d16e1da0e9127d66 (diff) | |
download | qtlocation-mapboxgl-318690645eb57e5c0092574e54a660991383dbec.tar.gz |
[test] Added unit test for style request failures
Diffstat (limited to 'test/storage')
-rwxr-xr-x | test/storage/server.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/storage/server.js b/test/storage/server.js index 92e9e9e0e7..b54ff835ec 100755 --- a/test/storage/server.js +++ b/test/storage/server.js @@ -127,6 +127,37 @@ app.get('/rate-limit', function(req, res) { res.status(429).end(); }); +var styleFailOnce500 = true; +app.get('/style-fail-once-500', function (req, res) { + if (styleFailOnce500) { + res.status(500).send('Server Error!'); + styleFailOnce500 = false; + } else { + res.status(200).send('{ "version": 8, "name": "Teste Style" }'); + } +}); + +var styleFailOnce404 = true; +app.get('/style-fail-once-404', function (req, res) { + if (styleFailOnce404) { + res.status(404).send('Not found!'); + styleFailOnce404 = false; + } else { + res.status(200).send('{ "version": 8, "name": "Teste Style" }'); + } +}); + +var styleFailOnce404Cache = true; +app.get('/style-fail-once-404-cache', function (req, res) { + if (styleFailOnce404Cache) { + res.setHeader('Cache-Control', 'max-age=30'); + res.status(404).send('Not found!'); + styleFailOnce404Cache = false; + } else { + res.status(200).send('{ "version": 8, "name": "Teste Style" }'); + } +}); + app.get('/delayed', function(req, res) { setTimeout(function() { res.status(200).send('Response'); |