New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fist-fistlabs_unit_asker

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fist-fistlabs_unit_asker

Fist plugin providing asker unit

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

fist-fistlabs_unit_asker Build Status

Fist plugin which provides the unit to create http requests with asker

Unit _fistlabs_unit_asker inherits from _fistlabs_unit_serial, expresses any http request in 5 steps:

  • options - creating request options
  • prepare - prepare request options
  • request - do request
  • compile - parse response
  • resolve - check, validate response, then return result

#Usage:

$ npm i fist-fistlabs_unit_asker
app.install('fist-fislabs_unit_asker');
app.unit({
    base: '_fistlabs_unit_asker',
    name: 'news.posts',
    options: function (track, context) {
        return {
            //  any options supported by asker
            host: 'backend.example.com',
            port: 3000,
            path: '/get-news/'
        };
    },
    resolve: function (track, context) {
        var newsList = this.__base(track, context);
        return newsList.filter(function (item) {
            return item.hidden !== true;
        });
    }
});

#Tips and tricks: By default prepare step supports path factories as paths.

app.unit({
    base: '_fistlabs_unit_asker',
    name: 'news.post',
    options: function (track, context) {
        return {
            host: 'backend.example.com',
            port: 3000,
            path: {
                build: function (vars) {
                    return util.format('/news/post/%s/', vars.postId)
                }
            },
            vars: {
                postId: context.p('postId')
            }
        };
    }
});

So you can use finger routes to create paths easier:

var Rule = require('finger/core/rule');

var postPath = new Rule('/news/post/<postId>/');

app.unit({
    base: '_fistlabs_unit_asker',
    name: 'news.post',
    options: function (track, context) {
        return {
            host: 'backend.example.com',
            port: 3000,
            path: postPath,
            vars: {
                postId: context.p('postId')
            }
        };
    }
});

LICENSE MIT

FAQs

Package last updated on 17 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc