You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

hrequest

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

hrequest

ARCcore.filter data validation/normalization wrappers for XMLHttpRequest (browser) and request module (Node.js).

0.3.1
unpublished
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Filter Object README

[B5dMHTIAQD2pjmji8kp_FA::Client Hrequest Filter Factory]

Constructs a client-side Hrequest filter object.

Operation

This operation is dispatched by calling the filter object's request method passing a single value input:

var response = filter.request(input);
if (response.error) {
    throw new Error(response.error); // <- response.result invalid
}
var result = response.result; // <- response.result valid

Request Input

This filter normalizes the value of input passed to its request method using the following filter spec contract:

{
    "____types": "jsObject",
    "name": {
        "____label": "HTTP Request Operation Name",
        "____description": "A short descriptive name to assign to the generated HTTP request filter object.",
        "____accept": "jsString"
    },
    "description": {
        "____label": "HTTP Request Operation Description",
        "____description": "A longer description of the purpose and functionality to assign to the generated HTTP request filter object.",
        "____accept": "jsString"
    },
    "url": {
        "____label": "HTTP Request URL",
        "____description": "Full URL of the remote endpoint to query including the leading HTTP protocol designation.",
        "____accept": "jsString"
    },
    "method": {
        "____label": "HTTP Request Method",
        "____description": "The specific HTTP request method to make requests with.",
        "____accept": "jsString",
        "____inValueSet": [
            "GET",
            "POST"
        ]
    },
    "querySpec": {
        "____label": "HTTP Request Query Params Object Filter Spec",
        "____description": "An Encapsule/arccore.filter-format JavaScript object descriptor specifying the schema of the query specification object that may be optionally specified at request time.",
        "____accept": "jsObject",
        "____defaultValue": {
            "____opaque": true
        }
    },
    "requestSpec": {
        "____label": "HTTP Request Body Params Object Filter Spec",
        "____description": "An Encapsule/arccore.filter-format JavaScript object descriptor specifying the schema of the main request object to pass as the body of the HTTP request.",
        "____accept": "jsObject",
        "____defaultValue": {
            "____opaque": true
        }
    },
    "resultSpec": {
        "____label": "HTTP Result Object Filter Spec",
        "____description": "An Encapsule/arccore.filter-format JavaScript object descriptor specifiying the schema of the result data that the remote endpoint is expected/required to return in response to the HTTP request.",
        "____accept": [
            "jsUndefined",
            "jsObject"
        ]
    },
    "resultHandler": {
        "____label": "HTTP Result Handler",
        "____description": "A JavaScript function to be called by the generated HTTP request filter when the request completes successfully.",
        "____accept": "jsFunction"
    },
    "errorHandler": {
        "____label": "HTTP Response Error Handler",
        "____description": "A JavaScript function to be called by the generated HTTP request filter if the request fails.",
        "____accept": "jsFunction"
    }
}

Response Output

This filter's request method returns a normalized response object when called.

var response = filter.request(input);
var result = undefined; // assume nothing
// You must check for an error condition.
if (!response.error) {
    // Operation succeeded and response.result is a valid value.
    result = response.result;
} else {
    // Operation failed and response.error is a string error message.
    throw new Error(response.error); // e.g.
}
// Use value held by result variable for subsequent operations...

Result Format

If no error then the value assigned to response.result is normalized per the following filter spec contract:

{
    "____accept": "jsObject",
    "____label": "Browser HTTP Request Filter"
}

Implementation

Identifiers

filter identifierversion independentversion dependent
operationB5dMHTIAQD2pjmji8kp_FAtkpLqwSo5dGk-p33dDtrFQ
input contractiLvwFYq42kkAlf4Wdskqywonq0q4sVFTH8LJBHOcbc_Q
output contractYoEEvI6eJy0wX8ZZUMIpmAJi6UAahFYATh97sTtTwPdg

Configuration

Filter classification: normalized operation

request stagestage descriptionstate
1. Input FilterRejects invalid input requests and shapes to well-formed.true
2. OperationDeveloper-defined custom data transformation function.true
3. Response FilterVerifies the response of the developer-defined operation function.true
4. Output FilterRejects invalid output result data and shapes to well-formed.true
Filters are created with the [Encapsule/arccore](https://github.com/Encapsule/arccore/) library.
This document was generated with [Encapsule/arctools](https://github.com/Encapsule/arctools/) v0.0.12 toolset.
Document updated Wed Jul 19 2017 13:41:04 GMT-0700 (PDT)

FAQs

Package last updated on 03 Feb 2018

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