CLI and IDE plugin to test REST API, GraphQL, gRPC, Kafka Pub/Sub services with HTTP DSL
#!/usr/bin/env httpx --httpfile
### get my internet ip
# @name myip
GET https://httpbin.org/ip
|
1. Assigned by --justfile option
|
|
2. Find index.http in current directory
|
|
3. Try to find index.http in parent dir util to root
|
|
4. Load default $HOME/.httpx/index.http
|
$ httpx --list
$ httpx myip
$ echo hello | httpx post
$ httpx post --data @/path/to/file
$ httpx --completions zsh
httpx -f demo.http --import https://api.example.com/openapi.jsonn
### 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]
### send an email by Gmail
//@name mail
MAIL mailto:demo@example.com
Host: tls://smtp.gmail.com:587
Authorization: Basic your_name@gmail.com:google_app_password
From: your_name@gmail.com
Subject: e-nice to meet you
Content-Type: text/plain
Hi Master:
bala bala ...
Best regards
Yours sincerely Zombie
### grpc call SayHello
//@name SayHello
GRPC localhost:50052/Greeter/SayHello
{
"name": "Jackie"
}
### graphql query
GRAPHQL https://countries.trevorblades.com/
Content-Type: application/graphql
query { continents { name } }
### graphql query over WebSocket
GRAPHQL ws://localhost:4000/graphql
Content-Type: application/graphql
subscription { greetings }
### graphql over RSocket
GRAPHQL rsocketws://localhost:8080/rsocket/graphql
Content-Type: application/graphql
query { continents { name } }
### RSocket Request
// @name rsocket-request
RSOCKET com.example.UserService.findById
Host: 127.0.0.1:42252
Content-Type: application/json
1
### RSocket Request
//@name rsocket-stream
STREAM com.example.UserService.findAll
Host: ws://127.0.0.1:8080/rsocket
Content-Type: application/json
"vip"
### Dubbo sayHi
//@name sayHi
DUBBO 127.0.0.1:20880/GreetingsService/sayHi(java.lang.String)
Content-Type: application/json
"jackie"
### zeromq request
//@name zero-req
ZEROREQ 127.0.0.1:5555
Content-Type: application/json
"Jackie"
### subscribe zeromq
//@name zero-sub
SUB topic1
Host: zeromq://localhost:5555
### thrift request
THRIFT 127.0.0.1:9090/getUser
Content-Type: application/json
{
"1": {"i32": 1}
}
### publish kafka message
//@name kafka-pub
PUB topic-1
Host: kafka://localhost:9092
Content-Type: application/json
{
"name": "Jackie"
}
### subscribe kafka topic
//@name kafka-sub
SUB topic-1
Host: kafka://localhost:9092
### publish kafka message
//@name pulsar-pub
PUB topic-1
Host: pulsar://localhost:6650
Content-Type: application/json
{
"name": "Jackie"
}
### subscribe Pulsar topic
//@name pulsar-sub
SUB topic-1
Host: pulsar://localhost:6650
### publish RabbitMQ message
//@name rabbit-pub
PUB queue1
Host: amqp://localhost:5672
Content-Type: application/json
{
"name": "Jackie"
}
### Subscribe RabbitMQ queue
//@name rabbit-sub
SUB queue1
Host: amqp://localhost:5672
### publish redis message
//@name redis-pub
PUB channel1
Host: redis://localhost:6379
Content-Type: application/json
{
"name": "Jackie"
}
### subscribe redis
//@name redis-sub
SUB channel1
Host: redis://localhost:6379
* Nats
* AMQP, MQTT, Stomp
* Aliyun MNS/EventBridge
* AWS SNS/SQS/EventBridge
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.