unexpected-http-alexjeffburke

Unexpected plugin for testing http servers

Usage no npm install needed!

<script type="module">
  import unexpectedHttpAlexjeffburke from 'https://cdn.skypack.dev/unexpected-http-alexjeffburke';
</script>

README

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/
        });
    });
});