servicex-sh/httpx
Fork: 9 Star: 133 (更新于 2024-11-18 06:14:18)
license: Apache-2.0
Language: Java .
httpx - CLI to test HTTP/gRPC/RSocket/Kafka... services by HTTP DSL
最后发布版本: v0.42.4 ( 2024-03-03 19:25:06)
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?
- Mac :
brew install servicex-sh/tap/httpx
- Other platform: download binary from https://github.com/servicex-sh/httpx/releases
- JetBrains IDEs plugin: https://plugins.jetbrains.com/plugin/18807-httpx-requests
- Neovim plugin: https://github.com/servicex-sh/httpx.vim
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: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:
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:name@email.com?cc=name2@email.com
- Gmail: please use App Password from https://support.google.com/accounts/answer/185833?p=InvalidSecondFactor
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
Tips
- Name request with
#@name myname
: you can invoke request withhttpx myname
- Describe request with
### request description here
- Generate http file from openapi: please refer OpenAPI Generator
openapi-generator-cli generate -i https://api.opendota.com/api -g jetbrains-http-client -o dotaClient
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
- httpbin: HTTP test https://httpbin.org/
- grpcbin: gRPC test https://grpcb.in/
- GraphQLZero: https://graphqlzero.almansi.me/ endpoint: https://graphqlzero.almansi.me/api
- Ethereal Email: Ethereal is a fake SMTP service for email sending test https://ethereal.email/
References
- JetBrains HTTP client: https://www.jetbrains.com/help/idea/http-client-in-product-code-editor.html
- http-request-in-editor-spec: https://github.com/JetBrains/http-request-in-editor-spec/blob/master/spec.md
- Awaitility: small Java DSL for synchronizing asynchronous operations https://github.com/awaitility/awaitility
- RSocket: https://rsocket.io/
- gRPCurl: https://github.com/fullstorydev/grpcurl
- picocli: https://picocli.info/
- GraalVM: https://www.graalvm.org/
- UPX: Ultimate Packer for eXecutables - https://upx.github.io/
- type-detecting-hints-for-third-party-libraries: https://github.com/joshlong/type-detecting-hints-for-third-party-libraries
- IANA Message Headers: https://www.iana.org/assignments/message-headers/message-headers.xhtml
- MailCatcher: https://github.com/sj26/mailcatcher/
最近版本更新:(数据更新于 2024-09-07 05:55:24)
2024-03-03 19:25:06 v0.42.4
2023-05-04 15:33:09 v0.41.1
2023-05-04 09:49:31 v0.41.0
2023-02-04 00:21:55 v0.40.0
2023-01-08 13:04:26 v0.39.0
2022-12-24 13:41:41 v0.38.0
2022-10-24 10:03:09 v0.37.1
2022-10-21 12:46:00 v0.36.0
2022-10-10 09:30:02 v0.35.2
2022-08-13 10:18:25 v0.35.1
servicex-sh/httpx同语言 Java最近更新仓库
2024-11-22 14:41:49 dromara/dante-cloud
2024-11-22 01:55:02 spring-projects/spring-boot
2024-11-21 09:44:43 Card-Forge/forge
2024-11-20 14:38:43 StarRocks/starrocks
2024-11-19 23:42:52 spring-projects/spring-authorization-server
2024-11-18 21:40:12 4379711/lol-helper