1.0.10 • Published 3 months ago

@jbscript/rest-runner v1.0.10

Weekly downloads
-
License
ISC
Repository
github
Last release
3 months ago

Getting Started

A simple REST API runner using Axios

Installation

Below is an example of how you can install and setup this package.

import RestRunner from "@jbscript/rest-runner";
const executor = new RestRunner();
const response = await executor.send(payload);

Payload Sample

{
    "url": "https://postman-echo.com/post",
    "method": "POST",
    "body": {
        "type": "application/json",
        "data": "{\n  \"id\":123,\n  \"name\":\"jabir\"\n}",
        "form": [
            {
                "id": "6DZo29cPhzx6gHlobQRK6",
                "key": "",
                "value": "",
                "enable": true
            }
        ]
    },
    "authorization": {
        "type": "none",
        "token": "",
        "username": "",
        "password": ""
    },
    "parameters": [
        {
            "id": "3lZxqD5dgJJnL-SEDLziy",
            "key": "",
            "value": "",
            "enable": true
        }
    ],
    "headers": [
        {
            "id": "FLMQdu6-tG_Uht495mpcv",
            "key": "",
            "value": "",
            "enable": true
        }
    ],
    "testscript": "aq.test(\"Status code is 200\", () => {\n return aq.expect(aq.response.status).toBe(200);\n});   \n\naq.test(\"Status code is 4xx\", () => {\n return aq.expect(Math.floor(aq.response.status / 100) === 4).toBe(true);\n});   \n\n",
    "timeout": 50000,
    "maxRedirects": 5,
    "withCredentials": false
}

Roadmap

  • Form Data (since form is a browser specific object / we can use form-data npm in node )
  • Form Upload File
  • Isolating Test Script (if browser run using webworker / in node VM2 or other alternative (Not sure maybe worker_threads or childprocess is also an option))
  • Pre Script run
  • tv4 for schema validation
  • chai for assertion

Tips

1.0.10

3 months ago

1.0.9

3 months ago

1.0.8

3 months ago

1.0.7

3 months ago

1.0.6

3 months ago

1.0.5

3 months ago

1.0.4

3 months ago

1.0.3

3 months ago

1.0.2

3 months ago

1.0.1

3 months ago

1.0.0

3 months ago