Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/weihanli/dotnet-httpie
Amazing HTTP command-line tool powered by .NET, inspired by httpie
https://github.com/weihanli/dotnet-httpie
curl dotnet-tool http http-cli httpie rest
Last synced: about 2 months ago
JSON representation
Amazing HTTP command-line tool powered by .NET, inspired by httpie
- Host: GitHub
- URL: https://github.com/weihanli/dotnet-httpie
- Owner: WeihanLi
- License: mit
- Created: 2021-02-08T15:57:22.000Z (almost 4 years ago)
- Default Branch: dev
- Last Pushed: 2024-03-25T05:19:51.000Z (10 months ago)
- Last Synced: 2024-04-25T12:03:03.305Z (9 months ago)
- Topics: curl, dotnet-tool, http, http-cli, httpie, rest
- Language: C#
- Homepage:
- Size: 554 KB
- Stars: 27
- Watchers: 3
- Forks: 2
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dotnet-HTTPie
[![dotnet-HTTPie](https://img.shields.io/nuget/v/dotnet-HTTPie)](https://www.nuget.org/packages/dotnet-HTTPie/)
[![dotnet-HTTPie Latest](https://img.shields.io/nuget/vpre/dotnet-HTTPie)](https://www.nuget.org/packages/dotnet-HTTPie/absoluteLatest)
[![Github Actions Build Status](https://github.com/WeihanLi/dotnet-HTTPie/workflows/default/badge.svg?branch=dev)](https://github.com/WeihanLi/dotnet-HTTPie/actions?query=workflow%default+branch%3Adev)
[![Docker Pulls](https://img.shields.io/docker/pulls/weihanli/dotnet-httpie)](https://hub.docker.com/r/weihanli/dotnet-httpie)
## Intro
dotnet tool version of [httpie](https://github.com/httpie/httpie), Modern, user-friendly command-line HTTP client for the API era.
![httpie](https://raw.githubusercontent.com/httpie/httpie/master/docs/httpie-animation.gif)
HTTPie (pronounced aitch-tee-tee-pie) is a command-line HTTP client. Its goal is to make CLI interaction with web services as human-friendly as possible. HTTPie is designed for testing, debugging, and generally interacting with APIs & HTTP servers.
## Install
Install .NET SDK before you get started with this tool, when you had .NET SDK installed, run the command below to install the latest stable version tool
``` bash
dotnet tool update --global dotnet-httpie
```For latest preview version, run the following command instead:
``` bash
dotnet tool update --global dotnet-httpie --prerelease
```## GetStarted
Now you can use the tool to call your API you want
Usages:
> dotnet-http [flags] [METHOD] URL [ITEM [ITEM]]
There're three types of item
Type | Grammar
-----|-------
Query| name`==`test
Header| X-Api-Key`:`test
Request-Data | name`=`test, raw data field example(Only effective for JSON): age`:=`10, job`:=`'{"Id":1,"Name":"test"}'(Escape may needed for Windows cmd or Windows PowerShell)Here's a sample:
``` sh
dotnet-http https://reservation.weihanli.xyz/health test==1234 name=test age:=10 flag:=true job:='{"id": 1, "name": "test"}' api-key:Abc12345 --offline
```![sample](./images/sample.png)
More examples you may wanna have a look
``` bash
dotnet-http :5000/api/values
dotnet-http localhost:5000/api/values
dotnet-http get https://reservation.weihanli.xyz/api/notice --body
dotnet-http /api/notice title=test body=test-body
dotnet-http post http://localhost/api/notice title=test body=test-body
```## Execute
You can execute `*.http`/`*.rest` http requests with the `exec` command
``` sh
dotnet-http exec HttpStartedSample.httpdotnet-http exec ".\tests\HTTPie.IntegrationTest\TestAssets\HttpStartedSample.http"
dotnet-http exec ".\tests\HTTPie.IntegrationTest\TestAssets\HttpVariableSample.http"
dotnet-http exec ".\tests\HTTPie.IntegrationTest\TestAssets\HttpRequestReferenceSample.http"
```see http request sample here:
## Docker
There's a docker image(weihanli/dotnet-httpie) that you could use directly without installing the tool, use sample:
``` bash
docker run --rm --pull=always weihanli/dotnet-httpie:latest -v github.comdocker run --rm --pull=always weihanli/dotnet-httpie:latest reservation.weihanli.xyz/health job:='{"id":1,"name":"tester"}' --offline
docker run --rm --pull=always weihanli/dotnet-httpie:latest PUT httpbin.org hello=world
docker run --rm --pull=always weihanli/dotnet-httpie:latest get httpbin.org/status/400
```## More
For detailed document: have a look at HTTPie documents
## References
- httpie:
- httpie docs:
- Curl to HTTPie request tool: