srotas

command module
v0.1.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

srotas

A simple CLI for testing API.

Features

  • Send HTTP requests: GET, POST, PUT, DELETE, etc.
  • Request chaining: Reuse values from previous responses in subsequent requests.
  • Configuration: Define requests using YAML files.
  • Headers and query params: Add custom headers and query params to HTTP requests.
  • Assertions: Validate response for status, data, and headers.
  • Retry and error handling: Define retry and error handling mechanisms.
  • Control Structures: Define conditional, different loops.
  • WebSocket: Add support for web socket.
  • Config Generation: Generate config file with interactive mode.

YAML configuration

version: "1.0"
base_url: "<url>" # Base URL for all relative endpoints
timeout: 8000 # Request timeout in milliseconds
headers: # Common headers for all requests.
  Content-Type: "application/json"

sequence:
  name: "Happy Path"
  description: "Description"
  steps:
    - type: http
      step:
        name: "Get user details"
        method: GET
        url: "/users" # If base_url is specified, the URL defines the endpoint; otherwise, a full URL can be provided, which takes precedence
        delay: 3000
        store: # Extracts and saves data from the response
          user: "2.name" # Key is the name of the variable and value is the GJSON syntax for extracting JSON response value.
    - type: http
      step:
        name: "Create a task"
        method: POST
        headers:
          Content-Type: "application/json"
        url: "/tasks"
        body:
          file: "request1.json" # location of the request JSON file
          data:
            "name": "user" # Key is the SJSON syntax for modifying request JSON body and value is the variable name

GJSON is used to extract data from response JSON. Store property expects the key values to be in GJSON syntax. SJSON is used to add or replace JSON request values with variable values from the store. The data property of Body expects the key to be of SJSON syntax.

Usage

Build the binary using go cli.

Run configuration
$ srotas run CONFIGURATION.yaml
Run HTTP request
$ srotas http GET http://localhost:8080/task

See --help to know more about the commands.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL