GithubHelp home page GithubHelp logo

jonike / restless Goto Github PK

View Code? Open in Web Editor NEW

This project forked from anuragsoni/restless

0.0 3.0 0.0 150 KB

A C++ REST client. Make readable HTTP requests

Home Page: http://anuragsoni.github.io/restless/

License: MIT License

CMake 19.81% C++ 76.26% Shell 3.93%

restless's Introduction

Build Status Coverage Status

Warning:

The api might change as the library is in pre-alpha stage. If you find any bugs please open an issue.

Restless

Restless is a simple REST client for C++, powered by curl.

Integration

You can use your project's existing build system to compile all the files in src directory and link to your project.

To use this all you need to do is add

#include <restless.hpp>

// for a more readable name
using Http = asoni::Handle;

Examples

/*
 * A simple get request
 **/

auto res1 = Http().get("http://httpbin.org/get")
            .exec();

/*
 * A get request with basic auth and a custom header
 **/

auto res2 = Http().get("http://httpbin.org/get", "password-for-basic-auth")
            .header({{"Hello", "This is a header"}, {"Second","Another header"}})
            .exec();

/*
 * A post request with basic auth
 **/
auto post1 = Http().post("http://httpbin.org/post", "super-secret-password")
                    .content("text/plain", "Hello world")
                    .exec();

/*
 * A simple put request
 **/

auto put1 = Http().put("http://httpbin.org/put")
            .content("text/plain", "Hello world")
            .exec();

/*
 * A simple delete request
 **/

auto del = Http().del("http://httpbin.org/delete")
           .exec();

Dependencies

  • libcurl
  • A compiler with C++11 support (GCC 4.8 and higher, Clang 3.4 and higher)
  • cmake (At least version 2.8.11)
  • gtest - for building and running the tests
  • json - as a helper in testing

Note: A vagrant file has been provided that will provision a Ubuntu14.04 box with all the pre-requisites. Just vagrant up then vagrant ssh. You will find the code in /vagrant directory inside the vagrant box.

Steps to build

  • cd build
  • cmake ..
  • make
  • make test (optional)

Contribute

  • Fork the project
  • Make an addition or bugfix
  • Add test cases
  • Commit, then make a pull request (topic branches are recommended)

restless's People

Contributors

alexyangfox avatar anuragsoni avatar sergeyseroshtan avatar whoshuu avatar

Watchers

 avatar  avatar  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.