npm.io
5.5.0-patch2 • Published 10 years ago

unexpected-http-alexjeffburke

Licence
BSD-3-Clause
Version
5.5.0-patch2
Deps
5
Vulns
2
Weekly
0

unexpected-http

Unexpected plugin for testing HTTP servers. Uses same syntax as unexpected-express whenever possible.

Works with node.js and in browsers via browserify (see example).

NPM version Build Status Coverage Status Dependency Status

var expect = require('unexpected').clone().installPlugin(require('unexpected-http'));

describe('google.com', function () {
    it('should redirect to a country-specific version', function () {
        return expect('GET http://google.com/', 'to yield response', {
            statusCode: 302,
            headers: {
                Location: /www\.google\.\w+/
            },
            body: /The document has moved/
        });
    });
});

Keywords