Home

Awesome

⛵ yahttp - Awesome simple HTTP client for Nim

GitHub Release CI

Installation

nimble install yahttp

Examples

more examples here

Get HTTP status code

import yahttp

echo get("https://www.google.com/").status

Send query params and parse response to JSON

import json
import yahttp

let laptopsJson = get("https://dummyjson.com/products/search", query = {"q": "Laptop"}).json()
echo laptopsJson["products"][0]["title"].getStr()

API

Method procedures

get("http://api")
put("http://api")
post("http://api")
patch("http://api")
delete("http://api")
head("http://api")
options("http://api")

Arguments:

General procedure

request("http://api")

Has the same arguments as method procedures and one additional:

Response object

All procedures above return Response object with fields:

Response object has some helper procedures:

Other helper functions

object.toJsonString() - converts object of any type to json string. Helpful to use for body argument