Giter VIP home page Giter VIP logo

go-blast-request's Introduction

Go Blast Request

This Go program sends parallel HTTP requests to a specified endpoint, with the ability to define the HTTP method, request headers, body, and query parameters. The configuration is read from a JSON file.

Prerequisites

  • Go installed on your machine (version 1.16 or higher recommended)

Configuration

Create a target.json file in the same directory as the main.go file with the following structure:

{
    "url": "https://jsonplaceholder.typicode.com/posts/1",
    "method": "GET",
    "headers": {
        "Content-Type": "application/json"
    },
    "body": {},
    "query_params": {
        "param1": "value1",
        "param2": "value2"
    },
    "count": 10
}
  • url: The endpoint to which the requests will be sent.
  • method: The HTTP method to use for the - requests (e.g., GET, POST, PUT, PATCH).
  • headers: An object containing any headers to include in the requests.
  • body: An object representing the body of the request (only used for methods like POST, PUT, PATCH).
  • query_params: An object containing query parameters to include in the URL.
  • count: The number of parallel requests to send.

Usage

  • Clone the repository or copy the code files to your local machine.
  • Ensure that the target.json file is in the same directory as main.go.
  • Open a terminal and navigate to the directory containing main.go.
  • Run the program using the following command:
go run main.go

The program will read the configuration from target.json and send the specified number of parallel HTTP requests to the endpoint. The responses will be printed to the console.

Example

Given the target.json configuration above, the program will send 10 parallel GET requests to https://jsonplaceholder.typicode.com/posts/1 with the specified headers and query parameters.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Contributors

go-blast-request's People

Contributors

alitindrawan24 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.