npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

co-http-test

v0.3.1

Published

http request validations made easy

Downloads

2

Readme

co-http-test

Build Status npm npm

Validates results of one or more http requests. (optional) validate by status(defaults to 200), body, and headers

npm i --save co-http-test

const httpTest = require('co-http-test');

httpTest(description, request)
// description   : string
// request       : co/koa/generator compatible request.js call

for slightly more verbose output format description:

var str = 'test group description | test1 desc, test2 desc, etc'

examples

const httpTest = require('co-http-test').httpTest; // ".httpTest" only needed when httpUtil is used
const httpUtil = require('co-http-test').httpUtil;

const testApi = {
    gmaps: new $http('https://maps.googleapis.com/', {'x-hi-there': 'hello'}),
    endPoint: new $http('http://jsonplaceholder.typicode.com/')
};

httpTest('HTTP DELETE',testApi.endPoint.put('posts/1'))

httpTest('enforce response body | and status', testApi.endPoint.get('posts/1'),
    200,
    {
        "userId": 1,
        "id": 1,
        "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
        "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
    }
);

// request arrays are executed in parallel


httpTest('parallel HTTP test detailed description | details for POST, PUT details, PATCH details', [
    testApi.endPoint.post('posts/'),
    testApi.endPoint.put('posts/1', {
        title: 'test put'
    }),
    testApi.endPoint.patch('posts/1', {
        title: 'test patch'
    })
]);

httpTest('parallel HTTP enforce statuses | POST, PUT, PATCH', [
    testApi.endPoint.post('posts/'),
    testApi.endPoint.put('posts/1', {
        title: 'test put'
    }),
    testApi.endPoint.patch('posts/1', {
        title: 'test patch'
    })
], [201, 200, 200]);


httpTest('enforce response body | status and headers', testApi.endPoint.get('posts/1'),
    200,
    {
        "userId": 1,
        "id": 1,
        "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
        "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
    },
    {
        'x-powered-by': 'Express'
    }
);

credits

  • https://github.com/maxmill/rain-util-http
  • https://github.com/request/request
  • https://github.com/substack/tape