Pretend is a macros-based declarative Rust HTTP client

Related tags

HTTP Client pretend
Overview

pretend

Build codecov

pretend is a modular, Feign-inspired HTTP, client based on macros. It's goal is to decouple the definition of a REST API from it's implementation.

Some features:

  • Declarative
  • Asynchronous-first implementations
  • HTTP client agnostic
  • JSON support thanks to serde

This repository contains the code for pretend and pretend-codegen as well as pretend-reqwest and pretend-ishac.

MSRV for the pretend ecosystem is Rust 1.44.

You might also like...
๐Ÿฑโ€๐Ÿ‘ค Drop-in HTTP replacement module for Garry's Mod

๐Ÿฑโ€๐Ÿ‘ค gmsv_reqwest This module is a drop-in replacement for Garry's Mod's HTTP function, inspired by gmsv_chttp created by timschumi. The module uses

Multi-stream HTTP downloader using range requests

chooch - An Amazing Project Downloads files faster than wget/curl (in theory) using multiple connections. Chooch recycles the slowest connection and r

xh is a friendly and fast tool for sending HTTP requests. It reimplements as much as possible of HTTPie's excellent design, with a focus on improved performance.
xh is a friendly and fast tool for sending HTTP requests. It reimplements as much as possible of HTTPie's excellent design, with a focus on improved performance.

xh is a friendly and fast tool for sending HTTP requests. It reimplements as much as possible of HTTPie's excellent design, with a focus on improved performance

Wrapper around reqwest to allow for client middleware chains.

reqwest-middleware A crate implementing a wrapper around reqwest to allow for client middleware chains. Overview The reqwest-middleware client exposes

Rust bindings to libcurl

curl-rust libcurl bindings for Rust Quick Start use std::io::{stdout, Write}; use curl::easy::Easy; // Print a web page onto stdout fn main() {

A GraphQL server library implemented in Rust

A GraphQL server library implemented in Rust Async-graphql is a high-performance server-side library that supports all GraphQL specifications. Feature

Typed, correct GraphQL requests and responses in Rust

graphql_client A typed GraphQL client library for Rust. Features Precise types for query variables and responses. Supports GraphQL fragments, objects,

A rule34 scraper made in rust this time

rust-34-scraper A rule34 scraper made in rust this time Building Clone the repository Execute cargo build --release --release is an optimized build pr

FeignHttp is a declarative HTTP client. Based on rust macros.

FeignHttp is a declarative HTTP client. Based on rust macros. Features Easy to use Asynchronous request Configurable timeout settings Suppor

An experimental HTTP server in Rust that supports HTTP/1.1, HTTP/2, and HTTP/3 over QUIC.

๐Ÿš€ H123 An experimental HTTP server in Rust that supports HTTP/1.1, HTTP/2, and HTTP/3 over QUIC. Warning This is an experimental project and not inte

What if we could check declarative macros before using them?
What if we could check declarative macros before using them?

expandable An opinionated attribute-macro based macro_rules! expansion checker. Textbook example rustc treats macro definitions as some opaque piece o

Let's pretend that life-before-main exists for Rust targeting WebAssembly

Let's pretend that life-before-main exists for Rust targeting WebAssembly. Installation Add a dependency on wasm-init. This crate intentionally provid

Js-macros - Quickly prototype Rust procedural macros using JavaScript or TypeScript!

js-macros Quickly prototype Rust procedural macros using JavaScript or TypeScript! Have you ever thought "this would be a great use case for a procedu

A more modern http framework benchmarker supporting HTTP/1 and HTTP/2 benchmarks.

rewrk A more modern http framework benchmark utility.

A library for building declarative text-based user interfaces
A library for building declarative text-based user interfaces

Intuitive docs.rs Documentation Intuitive is a component-based library for creating text-based user interfaces (TUIs) easily. It is heavily inspired b

A easy and declarative way to test JSON input in Rust.

assert_json A easy and declarative way to test JSON input in Rust. assert_json is a Rust macro heavily inspired by serde json macro. Instead of creati

Declarative Testing Framework

Demonstrate allows tests to be written without as a much repetitive code within the demonstrate! macro, which will generate the corresponding full tests.

Continuous Delivery for Declarative Kubernetes, Serverless and Infrastructure Applications
Continuous Delivery for Declarative Kubernetes, Serverless and Infrastructure Applications

Continuous Delivery for Declarative Kubernetes, Serverless and Infrastructure Applications Explore PipeCD docs ยป Overview PipeCD provides a unified co

`boxy` - declarative box-drawing characters

boxy - declarative box-drawing characters Box-drawing characters are used extensively in text user interfaces software for drawing lines, boxes, and o

Comments
  • Make boxed errors Send + Sync by default

    Make boxed errors Send + Sync by default

    By default, errors that are boxed in pretend::Error have the Send + Sync bound.

    To support pretend-awc, a new feature local-error is introduced to drop this requirement. This feature is enabled by default for pretend-awc

    enhancement 
    opened by SfietKonstantin 2
  • Distinguish between local and non local errors

    Distinguish between local and non local errors

    The goal of this commit is to introduce Send + Sync traits to errors wrapped in Error. This conflicts with local client implementations, that may not support Send + Sync errors.

    To workaround this issue, we introduce a new local module, in which a local version of Error is put in place. Local clients will return this error type instead. Standard and blocking clients will still return the existing Error type, that will be enriched with the Send + Sync bounds.

    enhancement breaking 
    opened by SfietKonstantin 2
  • Moved MSRV enforcements as separate test

    Moved MSRV enforcements as separate test

    Removed constraints on dependencies in pretend-* crates so that latest clients can be used for stable Rust users.

    A specific test is introduced to make sure that, with some constraints, MSRV can still be Rust 1.44.

    enhancement ci 
    opened by SfietKonstantin 1
Releases(0.3.0)
  • 0.3.0(Aug 14, 2021)

    This release adds flexibility in configuring the HTTP clients, by allowing disabling HTTP client default features directly through the pretend-* crate. It also remove request and header attribute macros. Only pretend attribute macro is required to write pretend enabled traits. The other attributes will be handled automatically by pretend.

    Changed

    Added

    • Disabled default features for HTTP clients (#37) @SfietKonstantin
    • Removed request and header attributes (#25) @SfietKonstantin

    Fixes

    • Fixed tests (#41) @SfietKonstantin
    • Enforced Rust 1.44 MSRV (#38) @SfietKonstantin
    • Moved MSRV enforcements as separate test (#39) @SfietKonstantin
    Source code(tar.gz)
    Source code(zip)
  • 0.2.2(Aug 11, 2021)

    This release brings the support for ureq. It also improves the Error type, that wraps errors that are Send + Sync. This improves the Error type and makes it compatible with (eg) anyhow ... ... except if you are using awc.

    Added

    • Added support for ureq (#29) @SfietKonstantin

    Changed

    • Updated documentation (#35) @SfietKonstantin
    • Make boxed errors Send + Sync by default (#34) @SfietKonstantin

    Fixed

    • Fixed test failures with latest Rust version (#33) @SfietKonstantin
    Source code(tar.gz)
    Source code(zip)
  • 0.2.1(Jun 27, 2021)

    Changed

    • Report inconsistent async more accurately (#26) @SfietKonstantin
    • Forbid unsafe (#24) @SfietKonstantin
    • Style: worked-around rustfmt (#23) @SfietKonstantin
    • Cleanups (#22) @SfietKonstantin
    • Derive some useful traits (#28) @orzogc

    Fixed

    • remove Cargo.lock and add Cargo.lock in .gitignore (#21) @orzogc
    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(Jun 23, 2021)

    Changed

    • Added rustfmt check (#17) @SfietKonstantin

    Added

    • awc support (#16) @SfietKonstantin
    • Introduced blocking and local clients (#15) @SfietKonstantin
    • Reviewed client tests (#14) @SfietKonstantin
    • Improved error reporting (#12) @SfietKonstantin

    Fixed

    • Propagate visibility keyword to the generated trait (#19) @SfietKonstantin
    • Do not re-export serde traits (#18) @SfietKonstantin
    Source code(tar.gz)
    Source code(zip)
  • 0.1.1(May 12, 2021)

    This release brings a little level of polish over the initial release.

    Changed

    Updates

    • Do not require static lifetime for bytes bodies (#8) @SfietKonstantin
    • Some traits like Debug and Eq are implemented on Json and JsonResult

    Added

    • Added MSRV information (#10) @SfietKonstantin
    • Added examples on how to use pretend (#9) @SfietKonstantin
    • Updated links to client crates in the doc (#7) @SfietKonstantin
    • Improved tests with more coverage on clients and outputs (#6) @SfietKonstantin
    • Updated docs location for crates.io (#5) @SfietKonstantin
    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(May 10, 2021)

    This is the initial release. It introduces pretend and it's codegen as well as two pretend clients.

    Changed

    • Implemented a release pipeline (#3) @SfietKonstantin

    Added

    • Added documentation (#2) @SfietKonstantin
    • Implemented isahc support (#1) @SfietKonstantin

    Fixed

    • Fixed a few hiccups before release (#4) @SfietKonstantin
    Source code(tar.gz)
    Source code(zip)
Owner
null
A more modern http framework benchmarker supporting HTTP/1 and HTTP/2 benchmarks.

rewrk A more modern http framework benchmark utility.

Harrison Burt 273 Dec 27, 2022
An easy and powerful Rust HTTP Client

reqwest An ergonomic, batteries-included HTTP Client for Rust. Plain bodies, JSON, urlencoded, multipart Customizable redirect policy HTTP Proxies HTT

Sean McArthur 6.8k Dec 31, 2022
Minimal Rust HTTP client for both native and WASM

ehttp: a minimal Rust HTTP client for both native and WASM If you want to do HTTP requests and are targetting both native and web (WASM), then this is

Emil Ernerfeldt 105 Dec 25, 2022
HTTPie: human-friendly CLI HTTP client for the API era

HTTPie: human-friendly CLI HTTP client for the API era HTTPie (pronounced aitch-tee-tee-pie) is a command-line HTTP client. Its goal is to make CLI in

null 25.4k Dec 30, 2022
rh: user-friendly command-line HTTP client

Rust HTTP Cli The command name in your terminal is rh. rh: user-friendly command-line HTTP client rh is a user-friendly, lightweight and performant co

null 8 Nov 30, 2022
An HTTP library for Rust

hyper A fast and correct HTTP implementation for Rust. HTTP/1 and HTTP/2 Asynchronous design Leading in performance Tested and correct Extensive produ

null 11k Jan 8, 2023
Pyre - A fast python HTTP server inspired by japronto written in rust.

Pyre - A fast python HTTP server inspired by japronto written in rust.

null 135 Nov 26, 2022
Fast and friendly HTTP server framework for async Rust

Tide Serve the web API Docs | Contributing | Chat Tide is a minimal and pragmatic Rust web application framework built for rapid development. It comes

http-rs 4.1k Jan 2, 2023
ratpack: a simpleton's HTTP framework (for rust-lang)

ratpack: a simpleton's HTTP framework (for rust-lang) ratpack is idealized in the simplicity of the sinatra (ruby) framework in its goal, and attempts

ZeroTier, Inc. 5 Jun 29, 2022
A backend providing a HTTP REST like interface for uploading files written in rust.

UploadServer A backend providing a HTTP REST like interface for uploading files written in rust. API Documentation License This project is licensed un

null 4 Nov 20, 2022