Plato on Github
Report Home
request/tests/browser/test.js
Maintainability
79.81
Lines of code
35
Difficulty
9.80
Estimated Errors
0.18
Function weight
By Complexity
By SLOC
'use strict' if (!Function.prototype.bind) { // This is because of the fact that phantom.js does not have Function.bind. // This is a bug in phantom.js. // More info: https://github.com/ariya/phantomjs/issues/10522 /*eslint no-extend-native:0*/ Function.prototype.bind = require('function-bind') } var tape = require('tape') , request = require('../../index') tape('returns on error', function(t) { t.plan(1) request({ uri: 'https://stupid.nonexistent.path:port123/\\<-great-idea', withCredentials: false }, function (error, response) { t.equal(response.statusCode, 0) t.end() }) }) tape('succeeds on valid URLs (with https and CORS)', function(t) { t.plan(1) request({ uri: 'https://localhost:6767', withCredentials: false }, function (error, response) { t.equal(response.statusCode, 200) t.end() }) })