GithubHelp home page GithubHelp logo

effet / httpx Goto Github PK

View Code? Open in Web Editor NEW

This project forked from servicex-sh/httpx

0.0 0.0 0.0 760 KB

httpx - CLI to test HTTP/gRPC/RSocket/Kafka... services by HTTP DSL

Home Page: https://servicex.sh

License: Apache License 2.0

JavaScript 1.08% Java 98.90% Dockerfile 0.02%

httpx's Introduction

httpx: CLI for run http file

httpx is a CLI to execute requests from JetBrains Http File.

Request types supported by httpx

  • HTTP REST
  • PUB/SUB - Apache Kafka/Redpanda, Apache Pulsar, RabbitMQ, NATS, Redis, MQTT, AMQP, Stomp, ZeroMQ
  • gRPC
  • RSocket
  • Apache Dubbo
  • Sofa RPC
  • Email sending by SMTP
  • GraphQL over HTTP/WebSocket/RSocket
  • Memcache: set/get/delete
  • Redis: set/hmset/eval
  • msgpack-rpc: with Neovim support
  • json-rpc: HTTP and TCP transports support
  • Cloud Open API: AWS and Aliyun

How to install?

How to use?

Create index.http file with following code, then chmod u+x index.http

#!/usr/bin/env httpx --httpfile

### get my internet ip
# @name myip
GET https://httpbin.org/ip

### inspection http post
# @name post
POST https://httpbin.org/post
Content-Type: application/json

[ 1 ]

### RSocket Request
// @name request
RSOCKET com.example.UserService.findById
Host: 127.0.0.1:42252
Content-Type: application/json

1

### grpc call SayHello
//@name SayHello
GRPC localhost:50052/org.mvnsearch.service.Greeter/SayHello

{
  "name": "Jackie"
}

### graphql query
//@name query
GRAPHQL http://localhost:8080/graphql
Content-Type: application/graphql

query { hello }

### send an email by Gmail
//@name mail
MAIL mailto:[email protected]
Host: tls://smtp.gmail.com:587
Authorization: Basic [email protected]:google_app_password
From: [email protected]
Subject: e-nice to meet you
Content-Type: text/plain

Hi Master:
  this is testing email.

Best regards
Yours sincerely Zombie

Then input httpx myip or ./index.http myip to invoke request.

Protocols Support

  • HTTP Request
  • RSocket Request
  • GRPC Request: you should install grpcurl
  • GraphQL support: Query, Mutation and Subscribe on HTTP and WebSocket(graphql-ws)
  • EMAIL: send email by SMTP
  • PUB/SUB: pub/sub support for Kafka, RabbitMQ/ActiveMQ, Nats, Redis, MQTT, Stomp and Aliyun MNS/EventBridge.

Email sending

Email URL format: mailto:[email protected][email protected]

oh-my-zsh integration for shell completion

Please create ~/.oh-my-zsh/custom/plugins/httpx with following code, then add httpx to plugins in .zshrc file.

#compdef httpx
#autload

local subcmds=()

while read -r line ; do
   if [[ ! $line == Available* ]] ;
   then
      subcmds+=(${line/[[:space:]]*\#/:})
   fi
done < <(httpx --summary)

_describe 'command' subcmds

JavaScript Code test

JetBrains HTTP Client uses JavaScript ECMAScript 5.1 as response handler for test. httpx uses Node.js as JS engine, and you should install Node.js first.

### hello ip
GET https://httpbin.org/ip

> {%
    client.test("Request executed successfully", function() {
        client.log(response.status);
        client.log(response.contentType);
        client.log(response.body);
    });
%}

Attentions:

  • You should know the difference between ECMAScript 5.1 and Node.js
  • JavaScript code test is available for HTTP, gRPC, RSocket, Dubbo and other protocols with httpx

How to build from source?

httpx uses Toolchains Maven Plugin to build project, and you don't need to install GraalVM first, and GraalVM will be installed in ~/.m2/jdks.

./mvnw -Pnative -DskipTests clean package

Development setup

  • docker-compose.yml: MQTT/1883, Stomp/61613, RabbitMQ/5672, SMTP/1025, Redpanda/9092

References

httpx's People

Contributors

linux-china 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.